private string GetOutputCharacter(Pattern p) { return solver.GetClosestMatch((BitmapVector)p.Inputs).Information; }
private BitmapVector GetVector(Pattern p) { Bitmap b = ((BitmapVector)p.Inputs).GetBitmap(); DoubleVector dv = DoubleVector.Concatenate(b.GetScaledVectorVerticalHistogram(), b.GetScaledVectorHorizontalHistogram()); return BitmapVector.ConvertToLinearBitmapVector(dv); }
private string SolveOneCharacter(Pattern p) { // Run the pattern through each specialized neural net sann.ForEach(nn => nn.LastOutput = nn.NeuralNet.FeedForward(p.Inputs.Scale())[0]); // Sort the networks based on how likely their solution is the solution to the given pattern sann.Sort((a, b) => -a.LastOutput.CompareTo(b.LastOutput)); // Get the solution of the highest rated network for the given pattern return sann[0].Solution; }
private string GetOutputCharacter(Pattern p) { return solver.GetClosestMatch(GetVector(p)).Information; }
/// <summary> /// Use a winner-takes-all approach to determine what the most likely answer to a pattern is. /// </summary> /// <param name="p">The pattern to analyse</param> /// <returns></returns> private string GetOutputCharacter(Pattern p) { return GetOutputCharacter(p.Outputs); }