/// <summary> /// Copy from one mapping to another. Deep copy. /// </summary> /// <param name="source">The source mapping.</param> /// <param name="target">The target mapping.</param> public static void Copy(NeuralDataMapping source, NeuralDataMapping target) { for (int i = 0; i < source.From.Count; i++) { target.From[i] = source.From[i]; } for (int i = 0; i < source.To.Count; i++) { target.To[i] = source.To[i]; } }
/// <summary> /// Copy from one object to the other. /// </summary> /// /// <param name="source">The source object.</param> /// <param name="target">The target object.</param> public static void Copy(NeuralDataMapping source, NeuralDataMapping target) { for (int i = 0; i < source.From.Count; i++) { target.From[i] = source.From[i]; } for (int i_0 = 0; i_0 < source.To.Count; i_0++) { target.To[i_0] = source.To[i_0]; } }
public static void Copy(NeuralDataMapping source, NeuralDataMapping target) { int num = 0; while (true) { if (num >= source.From.Count) { for (int i = 0; i < source.To.Count; i++) { target.To[i] = source.To[i]; } if ((((uint) num) - ((uint) num)) >= 0) { return; } } else { target.From[num] = source.From[num]; } num++; } }
/// <summary> /// Compute the network for the specified input. /// </summary> /// /// <param name="input">The input to the network.</param> /// <returns>The output from the network.</returns> public NeuralDataMapping Compute(NeuralDataMapping input) { bool stable1; bool stable2; do { stable1 = PropagateLayer(_weightsF1ToF2, input.From, input.To); stable2 = PropagateLayer(_weightsF2ToF1, input.To, input.From); } while (!stable1 && !stable2); return null; }
public void Execute(IExampleInterface app) { this.app = app; var pattern = new BAMPattern(); pattern.F1Neurons = INPUT_NEURONS; pattern.F2Neurons = OUTPUT_NEURONS; var network = (BAMNetwork) pattern.Generate(); // train for (int i = 0; i < NAMES.Length; i++) { network.AddPattern( StringToBipolar(NAMES[i]), StringToBipolar(PHONES[i])); } // test for (int i = 0; i < NAMES.Length; i++) { var data = new NeuralDataMapping( StringToBipolar(NAMES[i]), RandomBiPolar(OUT_CHARS*BITS_PER_CHAR)); RunBAM(network, data); } app.WriteLine(); for (int i = 0; i < PHONES.Length; i++) { var data = new NeuralDataMapping( StringToBipolar(PHONES[i]), RandomBiPolar(IN_CHARS*BITS_PER_CHAR)); RunBAM(network, data); } app.WriteLine(); for (int i = 0; i < NAMES.Length; i++) { var data = new NeuralDataMapping( StringToBipolar(NAMES2[i]), RandomBiPolar(OUT_CHARS*BITS_PER_CHAR)); RunBAM(network, data); } }
public void RunBAM(BAMNetwork network, NeuralDataMapping data) { var line = new StringBuilder(); line.Append(MappingToString(data)); network.Compute(data); line.Append(" | "); line.Append(MappingToString(data)); app.WriteLine(line.ToString()); }
public String MappingToString(NeuralDataMapping mapping) { var result = new StringBuilder(); result.Append(BipolalToString((BiPolarMLData) mapping.From)); result.Append(" -> "); result.Append(BipolalToString((BiPolarMLData) mapping.To)); return result.ToString(); }
public NeuralDataMapping Compute(NeuralDataMapping input) { bool flag; bool flag2; do { flag = PropagateLayer(this._weightsF1ToF2, input.From, input.To); flag2 = PropagateLayer(this._weightsF2ToF1, input.To, input.From); } while (!flag && !flag2); return null; }