def test_load_mnist_one_hot(self): mnist_mat_train, mnist_label_train \ = dataset.load_mnist("sample_data", "training", one_hot = True) mnist_mat_test, mnist_label_test \ = dataset.load_mnist("sample_data", "testing", one_hot = True) self.tlog("mnist train data size : " + str(len(mnist_mat_train))) self.tlog("mnist test data size : " + str(len(mnist_mat_test)))
def test_load_mnist(self): mnist_mat_train, mnist_label_train \ = dataset.load_mnist("sample_data", "training", [0,1,2,3,4]) mnist_mat_test, mnist_label_test \ = dataset.load_mnist("sample_data", "testing", [0,1,2,3,4]) self.tlog("mnist train data size : " + str(len(mnist_mat_train))) self.tlog("mnist test data size : " + str(len(mnist_mat_test)))
def test_process(self): dg_mat_train, dg_label_train = dataset.load_mnist( "sample_data", "training") dg_mat_test, dg_label_test = dataset.load_mnist( "sample_data", "testing") knn_digit = KNN(dg_mat_train, dg_label_train, 10, 'euclidean') error_rate = autotest.eval_predict(knn_digit, dg_mat_test, dg_label_test, self.logging) self.tlog("digit predict (with basic knn) error rate :" + str(error_rate))
def test_process(self): dg_mat_train, dg_label_train = dataset.load_mnist("sample_data", "training", one_hot=True) dg_mat_test, dg_label_test = dataset.load_mnist("sample_data", "testing", one_hot=True) fnn = FNN(dg_mat_train, dg_label_train, [400, 100]) fnn.fit(lr=0.01, epoch=1000, err_th=0.00001, batch_size=100) error_rate = autotest.eval_predict(fnn, dg_mat_test, dg_label_test, self.logging, one_hot=True) self.tlog("digit predict (with fnn) error rate :" + str(error_rate))
def test_process(self): dg_mat_train, dg_label_train = dataset.load_mnist("sample_data", "training", one_hot=True) dg_mat_test, dg_label_test = dataset.load_mnist("sample_data", "testing", one_hot=True) logistic_reg = LogisticRegression(dg_mat_train, dg_label_train) logistic_reg.fit(lr=0.0001, epoch=1000, batch_size=100) error_rate = autotest.eval_predict(logistic_reg, dg_mat_test, dg_label_test, self.logging, one_hot=True) self.tlog("digit predict (with logistic regression) error rate :" + str(error_rate))
def test_process(self): dg_mat_train, dg_label_train = dataset.load_mnist("sample_data", "training", one_hot=True) dg_mat_test, dg_label_test = dataset.load_mnist("sample_data", "testing", one_hot=True) svc = SVC(dg_mat_train, dg_label_train) svc.fit(C=1.5, toler=0.0001, epoch=1000, kernel="RBF", kernel_params={"gamma": 0.7}) error_rate = autotest.eval_predict(svc, dg_mat_test, dg_label_test, self.logging, one_hot=True) self.tlog("digit predict (with svc) error rate :" + str(error_rate))