zoukankan      html  css  js  c++  java
  • aforge.net神经网络保存

    using System;
    using System.Collections.Generic;
    using System.Text;
     
    using AForge.Neuro;
    using AForge.Neuro.Learning;
     
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    using System.Runtime.Serialization;
     
    namespace khiNeuralNet
    {
        /// <summary>
        /// Allows saving and loading of the AForge Neural Network
        /// </summary>
        public class NeuralNetIO
        {
            // Protect the class from instantiation
            private NeuralNetIO() { }
     
            /// <summary>
            /// Save the network
            /// </summary>
            /// <param name="Net">The network to save</param>
            public static void SaveNet(ActivationNetwork Net, string FilePath)
            {
                FileStream fs = new FileStream(FilePath, FileMode.Create); 
                BinaryFormatter formatter = new BinaryFormatter(); 
                formatter.Serialize(fs, Net); 
                fs.Close();
            }
            
            /// <summary>
            /// Load a network
            /// </summary>
            /// <param name="FilePath">The path to the binary network file</param>
            /// <returns></returns>
            public static ActivationNetwork LoadNet(string FilePath)
            {
                FileStream fs = new FileStream(FilePath, FileMode.Open);
                BinaryFormatter formatter = new BinaryFormatter();  
                ActivationNetwork net = (ActivationNetwork)formatter.Deserialize(fs); 
                fs.Close();
                return net;
            }
     
        }
     
    }
  • 相关阅读:
    数学归纳法证明等值多项式
    整值多项式
    同余式
    欧拉定理&费马定理
    与模互质的剩余组
    欧拉函数的性质
    欧拉函数计数定理
    完全剩余组高阶定理
    51nod 1488 帕斯卡小三角 斜率优化
    51nod 1577 异或凑数 线性基的妙用
  • 原文地址:https://www.cnblogs.com/villa/p/3912755.html
Copyright © 2011-2022 走看看