public Tuple Infer(int[] inputPattern) { if (!SDRs.Any(ip => ip.SequenceEqual(inputPattern))) { string winner = Categories[SDRs.FindIndex(ip => ip.SequenceEqual(inputPattern))].First(); // format return values to match KNNClassifier return(new Tuple(winner)); } return(null); }
public void Learn(int[] inputPattern, string inputCategory, bool isSparse = false) { if (!SDRs.Any(ip => ip.SequenceEqual(inputPattern))) { SDRs.Add(inputPattern); Categories.Add(Categories.Count, new List <string> { inputCategory }); } else { Categories[SDRs.FindIndex(ip => ip.SequenceEqual(inputPattern))].Add(inputCategory); } }