public Neuron() { Weights = new Double[Constants.INPUT_SIZE]; RandomHolder rand = RandomHolder.GetInstance(); WeightBias = 1 / ((rand.getRandomDouble() * 100) + 1); }
//helper methods public void generateWeight() { RandomHolder rand = RandomHolder.GetInstance(); for (int i = 0; i < Weights.Length; i++) { Weights[i] = 1 / ((rand.getRandomDouble() * 100) + 1); } }
public void train(int phases) { RandomHolder rand = RandomHolder.GetInstance(); for (int i = 0; i < phases; i++) { int index = (int)(rand.getRandomDouble() * TrainSet.Count); TrainingSet t = TrainSet[index]; setInputs(t.getInputs()); adjustWeight(t.getOutputs()); } }