示例#1
0
        static INeuralNetwork BuildPsoNetwork()
        {
            var props = new NetworkProperties {
                              InitWeightMin = -0.1,
                              InitWeightMax = 0.1,
                              NumHidden = Globals.gNumHidden,  // orig 2
                              NumInput = Globals.gNumInput,    // orig 4
                              NumOutput = Globals.gNumOutput   // orig 3
            };

            var particleProps = new ParticleProperties {
                                        MaxVDelta = 2.0,
                                        MinVDelta = -2.0,
                                        V = 3.0,
                                        VSelf = 2.0,
                                        VSocial = 2.0
                                    };

            var netProps = new PsoNetworkProperties {
                                   DesiredAccuracy = 0.98,
                                   Iterations = Globals.gMaxIterations, // orig 1000,
                                   NumNetworks = 4,
                                   ParticleProps = particleProps
                               };

            return new PsoNetwork(netProps, props, new Random(0));
        }
        // ReSharper restore InconsistentNaming
        public NetworkData(NetworkProperties props)
        {
            this.Props = props.Clone();

            //weights
            this.ihWeights = MakeMatrix(this.Props.NumInput, this.Props.NumHidden);
            this.hBiases = new double[this.Props.NumHidden];
            this.hoWeights = MakeMatrix(this.Props.NumHidden, this.Props.NumOutput);
            this.oBiases = new double[this.Props.NumOutput];

            //input and output node values
            this.hOutputs = new double[this.Props.NumHidden];
            this.inputs = new double[this.Props.NumInput];
            this.outputs = new double[this.Props.NumOutput];
        }
示例#3
0
        // ReSharper restore InconsistentNaming

        public NetworkData(NetworkProperties props)
        {
            this.Props = props.Clone();

            //weights
            this.ihWeights = MakeMatrix(this.Props.NumInput, this.Props.NumHidden);
            this.hBiases   = new double[this.Props.NumHidden];
            this.hoWeights = MakeMatrix(this.Props.NumHidden, this.Props.NumOutput);
            this.oBiases   = new double[this.Props.NumOutput];

            //input and output node values
            this.hOutputs = new double[this.Props.NumHidden];
            this.inputs   = new double[this.Props.NumInput];
            this.outputs  = new double[this.Props.NumOutput];
        }
        public BackPropNetwork(NetworkProperties props, BackPropProperties backProps, Random rnd)
        {
            this.rnd       = rnd; // for Shuffle()
            this.backProps = backProps;

            this.Network = new NeuralNetwork(props, rnd);

            // back-prop related arrays below
            this.hGrads = new double[props.NumHidden];
            this.oGrads = new double[props.NumOutput];

            this.ihPrevWeightsDelta = NetworkData.MakeMatrix(props.NumInput, props.NumHidden);
            this.hPrevBiasesDelta   = new double[props.NumHidden];
            this.hoPrevWeightsDelta = NetworkData.MakeMatrix(props.NumHidden, props.NumOutput);
            this.oPrevBiasesDelta   = new double[props.NumOutput];
        }
示例#5
0
        public BackPropNetwork(NetworkProperties props, BackPropProperties backProps, Random rnd)
        {
            this.rnd = rnd; // for Shuffle()
            this.backProps = backProps;

            this.Network = new NeuralNetwork(props, rnd);

            // back-prop related arrays below
            this.hGrads = new double[props.NumHidden];
            this.oGrads = new double[props.NumOutput];

            this.ihPrevWeightsDelta = NetworkData.MakeMatrix(props.NumInput, props.NumHidden);
            this.hPrevBiasesDelta = new double[props.NumHidden];
            this.hoPrevWeightsDelta = NetworkData.MakeMatrix(props.NumHidden, props.NumOutput);
            this.oPrevBiasesDelta = new double[props.NumOutput];
        }
示例#6
0
        static INeuralNetwork BuildBackPropNetwork()
        {
            var props = new NetworkProperties {
                InitWeightMin = -0.1,
                InitWeightMax = 0.1,
                NumHidden = Globals.gNumHidden,  // orig 2
                NumInput = Globals.gNumInput,    // orig 4
                NumOutput = Globals.gNumOutput   // orig 3
            };

            var backProps = new BackPropProperties
                                {
                                    learnRate = 0.05,
                                    maxEprochs = Globals.gMaxIterations, // orig 2000,
                                    momentum = 0.00,
                                    weightDecay = 0.000,
                                    mseStopCondition = 0.020
                                };

            return  new BackPropNetwork(props, backProps, new Random(0));
        }
        static INeuralNetwork BuildBackPropNetwork()
        {
            var props = new NetworkProperties {
                InitWeightMin = -0.1,
                InitWeightMax = 0.1,
                NumHidden = 2,
                NumInput = 4,
                NumOutput = 3
            };

            var backProps = new BackPropProperties
                                {
                                    learnRate = 0.05,
                                    maxEprochs = 2000,
                                    momentum = 0.00,
                                    weightDecay = 0.000,
                                    mseStopCondition = 0.020
                                };

            return  new BackPropNetwork(props, backProps, new Random(0));
        }
示例#8
0
 public PsoNetwork(PsoNetworkProperties netProps, NetworkProperties props, Random rng)
 {
     this.PsoProps = netProps;
     this.NetworkProps = props;
     this.rng = rng;
 }
示例#9
0
 public PsoNetwork(PsoNetworkProperties netProps, NetworkProperties props, Random rng)
 {
     this.PsoProps     = netProps;
     this.NetworkProps = props;
     this.rng          = rng;
 }
示例#10
0
 public NeuralNetwork(NetworkProperties props, Random rng)
 {
     this.Data = new NetworkData(props);
     this.Data.InitializeWeights(rng, props.InitWeightMin, props.InitWeightMax);
 }
 public NeuralNetwork(NetworkProperties props, Random rng)
 {
     this.Data = new NetworkData(props);
     this.Data.InitializeWeights(rng, props.InitWeightMin, props.InitWeightMax);
 }