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)); }
public PsoParticle(NeuralNetwork network, ParticleProperties props, Random rnd) { this.bestAccuracy = 0.0; this.Network = network; var data = network.Data; this.props = props; this.rnd = rnd; var numvelocities = /*weights: */(data.Props.NumInput * data.Props.NumHidden) + (data.Props.NumHidden * data.Props.NumOutput) /*bias: */ + data.Props.NumHidden + data.Props.NumOutput; this.velocities = new double[numvelocities]; Array.Clear(this.velocities, 0, numvelocities); }
public PsoParticle(NeuralNetwork network, ParticleProperties props, Random rnd) { this.bestAccuracy = 0.0; this.Network = network; var data = network.Data; this.props = props; this.rnd = rnd; var numvelocities = /*weights: */ (data.Props.NumInput * data.Props.NumHidden) + (data.Props.NumHidden * data.Props.NumOutput) /*bias: */ + data.Props.NumHidden + data.Props.NumOutput; this.velocities = new double[numvelocities]; Array.Clear(this.velocities, 0, numvelocities); }