static EvaluatedData Evaluate(Trained[,] trained, TrainingData refineData, int have) { if (refineData.level != have) return null; EvaluatedData e = new EvaluatedData() { level = refineData.level, Label = refineData.Label, DocCount = refineData.DocCount }; for (int stop = 0; stop <= have; stop++) { if (trained[stop, have] == null) e.Score[stop] = float.MaxValue; else e.Score[stop] = trained[stop, have].predictor.Predict(new TrainingData(refineData, stop)).Score; } return e; }
static bool Score(EvaluatedData ev, float[] current, out float cost, out float origCost) { origCost = ev.DocCount; float end = ev.DocCount; for (int i = 0; i <=ev.level; i++) { if (ev.Score[i] <= current[i]) { end = TrainingData.Range[0]; break; } } cost = (float)Math.Min(end, origCost); return end >= ev.Label; }