Repository: incubator-systemml Updated Branches: refs/heads/master 0d625a05e -> 499428072
[SYSTEMML-1529] Improve accuracy score in test_svm of test_mllearn_numpy.py Adjusted tolerance parameter in test_svm to help prevent occasional failure due to accuracy not meeting test criteria of greater than 95%. Closes #460. Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/49942807 Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/49942807 Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/49942807 Branch: refs/heads/master Commit: 499428072b53fbc63547d190a85e551c11c4d474 Parents: 0d625a0 Author: Glenn Weidner <[email protected]> Authored: Sun Apr 16 10:53:49 2017 -0700 Committer: Glenn Weidner <[email protected]> Committed: Sun Apr 16 10:53:49 2017 -0700 ---------------------------------------------------------------------- src/main/python/tests/test_mllearn_numpy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/49942807/src/main/python/tests/test_mllearn_numpy.py ---------------------------------------------------------------------- diff --git a/src/main/python/tests/test_mllearn_numpy.py b/src/main/python/tests/test_mllearn_numpy.py index faa4d32..2a1bc3c 100644 --- a/src/main/python/tests/test_mllearn_numpy.py +++ b/src/main/python/tests/test_mllearn_numpy.py @@ -149,12 +149,14 @@ class TestMLLearn(unittest.TestCase): y_train = y_digits[:int(.9 * n_samples)] X_test = X_digits[int(.9 * n_samples):] y_test = y_digits[int(.9 * n_samples):] - svm = SVM(sparkSession, is_multi_class=True) + svm = SVM(sparkSession, is_multi_class=True, tol=0.0001) mllearn_predicted = svm.fit(X_train, y_train).predict(X_test) from sklearn import linear_model, svm clf = svm.LinearSVC() sklearn_predicted = clf.fit(X_train, y_train).predict(X_test) - self.failUnless(accuracy_score(sklearn_predicted, mllearn_predicted) > 0.95 ) + accuracy = accuracy_score(sklearn_predicted, mllearn_predicted) + evaluation = 'test_svm accuracy_score(sklearn_predicted, mllearn_predicted) was {}'.format(accuracy) + self.failUnless(accuracy > 0.95, evaluation) def test_naive_bayes(self): digits = datasets.load_digits()
