public void TestKnn() { var knn = new Knn(); var knnParameter = new KnnParameter(1, 3, new EuclidianDistance()); var laryToBinary = new LaryToBinary(car); laryToBinary.Convert(); knn.Train(car.GetInstanceList(), knnParameter); Assert.AreEqual(4.74, 100 * knn.Test(car.GetInstanceList()).GetErrorRate(), 0.01); laryToBinary = new LaryToBinary(tictactoe); laryToBinary.Convert(); knn.Train(tictactoe.GetInstanceList(), knnParameter); Assert.AreEqual(5.64, 100 * knn.Test(tictactoe.GetInstanceList()).GetErrorRate(), 0.01); }
public void TestKnn() { var knn = new Knn(); var knnParameter = new KnnParameter(1, 3, new EuclidianDistance()); var discreteToContinuous = new DiscreteToContinuous(car); discreteToContinuous.Convert(); knn.Train(car.GetInstanceList(), knnParameter); Assert.AreEqual(4.75, 100 * knn.Test(car.GetInstanceList()).GetErrorRate(), 0.01); discreteToContinuous = new DiscreteToContinuous(tictactoe); discreteToContinuous.Convert(); knn.Train(tictactoe.GetInstanceList(), knnParameter); Assert.AreEqual(5.64, 100 * knn.Test(tictactoe.GetInstanceList()).GetErrorRate(), 0.01); }
public void TestTrain() { var knn = new Knn(); var knnParameter = new KnnParameter(1, 3, new EuclidianDistance()); knn.Train(iris.GetInstanceList(), knnParameter); Assert.AreEqual(4.00, 100 * knn.Test(iris.GetInstanceList()).GetErrorRate(), 0.01); knn.Train(bupa.GetInstanceList(), knnParameter); Assert.AreEqual(19.42, 100 * knn.Test(bupa.GetInstanceList()).GetErrorRate(), 0.01); knn.Train(dermatology.GetInstanceList(), knnParameter); Assert.AreEqual(3.01, 100 * knn.Test(dermatology.GetInstanceList()).GetErrorRate(), 0.01); knn.Train(car.GetInstanceList(), knnParameter); Assert.AreEqual(4.75, 100 * knn.Test(car.GetInstanceList()).GetErrorRate(), 0.01); knn.Train(tictactoe.GetInstanceList(), knnParameter); Assert.AreEqual(5.64, 100 * knn.Test(tictactoe.GetInstanceList()).GetErrorRate(), 0.01); }
public void TestKnn() { var knn = new Knn(); var knnParameter = new KnnParameter(1, 3, new EuclidianDistance()); var pca = new Pca(iris); pca.Convert(); knn.Train(iris.GetInstanceList(), knnParameter); Assert.AreEqual(4.00, 100 * knn.Test(iris.GetInstanceList()).GetErrorRate(), 0.01); pca = new Pca(bupa); pca.Convert(); knn.Train(bupa.GetInstanceList(), knnParameter); Assert.AreEqual(19.13, 100 * knn.Test(bupa.GetInstanceList()).GetErrorRate(), 0.01); pca = new Pca(dermatology); pca.Convert(); knn.Train(dermatology.GetInstanceList(), knnParameter); Assert.AreEqual(3.28, 100 * knn.Test(dermatology.GetInstanceList()).GetErrorRate(), 0.01); }
public void TestKnn() { var knn = new Knn(); var knnParameter = new KnnParameter(1, 3, new EuclidianDistance()); var normalize = new Normalize(iris); normalize.Convert(); knn.Train(iris.GetInstanceList(), knnParameter); Assert.AreEqual(4.67, 100 * knn.Test(iris.GetInstanceList()).GetErrorRate(), 0.01); normalize = new Normalize(bupa); normalize.Convert(); knn.Train(bupa.GetInstanceList(), knnParameter); Assert.AreEqual(16.52, 100 * knn.Test(bupa.GetInstanceList()).GetErrorRate(), 0.01); normalize = new Normalize(dermatology); normalize.Convert(); knn.Train(dermatology.GetInstanceList(), knnParameter); Assert.AreEqual(1.91, 100 * knn.Test(dermatology.GetInstanceList()).GetErrorRate(), 0.01); }