public void Test(weka.core.Instances testInstances = null) { if (testInstances == null) { testInstances = CreateCurrentInstances(); } //if (m_cls is MLEA.IBatchClassifier) //{ // StringBuilder sb = new StringBuilder(); // MLEA.IBatchClassifier batchClassifier = m_cls as MLEA.IBatchClassifier; // double[] d = batchClassifier.classifyInstances(testInstances); // for (int i = 0; i < d.Length; ++i) // { // string s = string.Format("{0}, {1}: {2}", testInstances.instance(i).value(0).ToString("N2"), testInstances.instance(i).value(1).ToString("N2"), d[i].ToString("N0")); // sb.AppendLine(s); // } // this.Invoke(new Action(() => // { // txtEval.Text = sb.ToString(); // })); //} //else { MLEA.MyEvaluation eval = null; if (testInstances.classAttribute().isNominal()) { var costMatrix = MLEA.TestParameters.CostMatrix; eval = new MLEA.MyEvaluation(costMatrix); eval.evaluateModel(m_cls, testInstances); this.Invoke(new Action(() => { txtEval.Text = string.Format("TP:{0}, FP:{1}, Cost:{2}", eval.numTruePositives(1), eval.numFalsePositives(1), eval.totalCost().ToString()); })); } else { //eval = new MLEA.MyEvaluation(costMatrix); //eval.evaluateModel(m_cls, testInstances); //this.Invoke(new Action(() => //{ // txtEval.Text = eval.toSummaryString().Replace("\n", System.Environment.NewLine) // + System.Environment.NewLine; //})); } } }