public void TestNlClassify() { var advancedClassify = new AdvancedClassify(); var agesOnly = advancedClassify.LoadMatch(@"TestData\agesonly.csv", true); var offset = advancedClassify.GetOffset(agesOnly); TestOutput(advancedClassify.NlClassify(new[] { 30.0, 30 }, agesOnly, offset)); TestOutput(advancedClassify.NlClassify(new[] { 30.0, 25 }, agesOnly, offset)); TestOutput(advancedClassify.NlClassify(new[] { 25.0, 40 }, agesOnly, offset)); TestOutput(advancedClassify.NlClassify(new[] { 48.0, 20 }, agesOnly, offset)); }
public void TestNlClassifyMore() { var advancedClassify = new AdvancedClassify(); var numericalset = advancedClassify.LoadNumerical(); var result = advancedClassify.ScaleData(numericalset); var scaledSet = result.Item1; var scalef = result.Item2; var ssoffset = advancedClassify.GetOffset(scaledSet); TestOutput(numericalset[0].Match); TestOutput(advancedClassify.NlClassify(scalef(numericalset[0].NumData), scaledSet, ssoffset)); TestOutput(numericalset[1].Match); TestOutput(advancedClassify.NlClassify(scalef(numericalset[1].NumData), scaledSet, ssoffset)); TestOutput(numericalset[2].Match); TestOutput(advancedClassify.NlClassify(scalef(numericalset[2].NumData), scaledSet, ssoffset)); var newrow = new[] { 28, -1, -1, 26, -1, 1, 2, 0.8 };//男士不想要小孩,而女士想要 TestOutput(advancedClassify.NlClassify(scalef(newrow), scaledSet, ssoffset)); newrow = new[] { 28, -1, 1, 26, -1, 1, 2, 0.8 };//双方都想要小孩 TestOutput(advancedClassify.NlClassify(scalef(newrow), scaledSet, ssoffset)); }