public void Add(Label method, IEnumerable<int> heur1, IEnumerable<int> heur2)
 {
     if (heur1.Count() != heur2.Count()) throw new Exception();
     for (int i = 0; i < heur1.Count(); i++) {
         //I'm pretty sure this is fine, but we may want to check that this actually enumerates the whole thing just once:
         if (heur1.ElementAt(i) == heur2.ElementAt(i)) {
             indications[method][i].Match(); //match
         } else {
             indications[method][i].NonMatch(); //not a match
         }
     }
 }
예제 #2
0
 static void LogProgress(Label guessed, Label target)
 {
     bool guessedRight = guessed.TextRepresentation == target.TextRepresentation;
         rollingRightWrong.AddLast(guessedRight);
         if (guessedRight) {
             correct++;
         }
         if (rollingRightWrong.Count() > 100) {
             if (rollingRightWrong.First()) {
                 correct--;
             } rollingRightWrong.RemoveFirst();
         }
         Debug.Print(((double)correct / rollingRightWrong.Count()).ToString());
 }
예제 #3
0
        public int[][] AccessElement(int at, out Label label)
        {
            var a = lines.ElementAt(at);
            label = new Label(a.Split(',').First());
            var data = a.Split(',').Skip(1).Select(v => int.Parse(v));
            int[][] inputData = new int[28][];
            for (int i = 0; i < 28; i++) {
                inputData[i] = new int[28];
            }

            for (int i = 0; i < data.Count(); i++) {
                inputData[i / 28][i % 28] = data.ElementAt(i);
            }
            return inputData;
        }
예제 #4
0
 internal void Train(DetectedPoints pts, Label label, TestResult result)
 {
     if (!library.ContainsKey(label)) {
         library[label] = pts;
     } else {
         var baseVal = library[label].Compare(pts);
         foreach (var a in library) {
             if (a.Key == label) continue;
             var a1 = a.Value.Compare(pts);
             if (a1 > baseVal) {
                 a.Value.Sanitize(pts);
             }
         }
     }
 }
예제 #5
0
 internal void Push(Label label, double eval)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public void Train(double val, Label label)
 {
     if (!stats.ContainsKey(label)) {
         stats[label] = new RunningStats();
     }
     stats[label].Add(val, stats[label].Apply(val));
     if (stats[label].ElementsSeen < 10) return;
 }
예제 #7
0
 public void SetNextFeautreContext(int[][] features, Label label)
 {
     this.featureContext = features;
     this.DataLabel = label;
 }
예제 #8
0
 ///Knows how successul we have been
 ///Probability returned for correct assignment vs. probability
 ///returned for an incorrect assignment
 internal void Push(TestResult result, Label Label)
 {
     throw new NotImplementedException();
 }