From c5515107b8e3ead4724096d5c381608c957cc4df Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Wed, 6 Mar 2019 12:24:52 -0500 Subject: Add test for nonlinear training --- test/test_core.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/test_core.py b/test/test_core.py index 4be7df4..68d4b1e 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -180,6 +180,22 @@ class GenSVMTestCase(unittest.TestCase): label_set = set(labels) self.assertTrue(pred_set.issubset(label_set)) + def test_fit_nonlinear(self): + """ GENSVM: Fit and predict with nonlinear kernel """ + data = load_iris() + X = data.data + y = data.target_names[data.target] + + X_train, X_test, y_train, y_test = train_test_split( + X, y, random_state=123 + ) + clf = GenSVM(kernel="rbf", gamma=10, max_iter=5000, random_state=123) + clf.fit(X_train, y_train) + + pred = clf.predict(X_test, trainX=X_train) + self.assertTrue(set(pred).issubset(set(['versicolor', 'virginica', + 'setosa']))) + def test_fit_with_seed(self): """ GENSVM: Test fit with seeding """ -- cgit v1.2.3