private bool SymbolIsRecognised(IReadOnlyList <int> networkBipolarOutput) { for (var symbolIndex = 0; symbolIndex < NumberOfStoredSymbols; symbolIndex++) { int[] valuesOfLearnedSymbol = _learnedSymbols[symbolIndex].ConvertToOneDimensionalArray(); var symbolIsRecognised = true; for (var symbolValueIndex = 0; symbolValueIndex < NumberOfNeurons; symbolValueIndex++) { if (valuesOfLearnedSymbol[symbolValueIndex] != networkBipolarOutput[symbolValueIndex]) { symbolIsRecognised = false; break; } } if (symbolIsRecognised) { return(true); } symbolIsRecognised = true; for (var symbolValueIndex = 0; symbolValueIndex < NumberOfNeurons; symbolValueIndex++) { if (valuesOfLearnedSymbol[symbolValueIndex] != BipolarSymbol.InverseValue(networkBipolarOutput[symbolValueIndex])) { symbolIsRecognised = false; break; } } if (symbolIsRecognised) { return(true); } } return(false); }
public bool TryRecognise(BipolarSymbol symbolToRecognise) { return(Recognise(symbolToRecognise.ConvertToOneDimensionalArray())); }