//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// /// <summary> /// /// </summary> /// <param name="Unit"></param> /// <param name="LayerTotheRight"></param> /// <returns></returns> private double Sigmoud(Node Unit , ArrayList LayerTotheRight) { if (LayerTotheRight == null) //Neuron in Output Layer return (Unit.Output * (Unit.Target - Unit.Output) * ( 1 - Unit.Output)); else //Neuron in Hidden Layer return (Unit.Output * ( 1 - Unit.Output) * SumOF(LayerTotheRight , Unit.Number) ); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// /// <summary> /// For each input vector presented, /// the Euclidean distance to the output node is computed /// </summary> /// <param name="Input">input vector</param> /// <param name="Unit">the output</param> /// <returns>the Euclidean distance</returns> protected double Distance(ArrayList Input , Node Unit) { double Euclidean_distance = 0,Xi; for(int i = 0 ; i < Input.Count ; i++) { Xi = ((Node)Input[i]).Output; Euclidean_distance += ((Xi - Unit[i]) * (Xi - Unit[i])) ; } return Euclidean_distance; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// /// <summary> /// /// </summary> /// <param name="CurrentUnit"></param> /// <param name="PreviousLayer"></param> /// <returns></returns> private double Net(Node CurrentUnit, ArrayList PreviousLayer ) { double NET = 0; foreach(Node Unit in PreviousLayer ) { NET += Unit.Output * CurrentUnit.Weight(Unit.Number); } return (NET + CurrentUnit.Bias); }