Skip to content

Commit 7b58b8c

Browse files
committed
TEST add failing unit test
1 parent b2493de commit 7b58b8c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/test_runs/test_run_functions.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import sys
22

3+
from sklearn.dummy import DummyClassifier
4+
from sklearn.preprocessing import StandardScaler
35
from sklearn.linear_model import LogisticRegression, SGDClassifier, LinearRegression
46
from sklearn.ensemble import RandomForestClassifier, BaggingClassifier
57
from sklearn.svm import SVC
68
from sklearn.model_selection import RandomizedSearchCV, GridSearchCV, StratifiedKFold
9+
from sklearn.pipeline import Pipeline
710
import openml
811
import openml.exceptions
912
from openml.testing import TestBase
@@ -86,6 +89,19 @@ def test_run_optimize_bagging_iris(self):
8689
run = self._perform_run(task_id, num_instances, grid_search)
8790
self.assertEqual(len(run.trace_content), num_iterations * num_folds)
8891

92+
def test_run_pipeline(self):
93+
task_id = 10107
94+
num_instances = 150
95+
num_folds = 10
96+
num_iterations = 9 # (num values for C times gamma)
97+
98+
scaler = StandardScaler(with_mean=False)
99+
dummy = DummyClassifier(strategy='prior')
100+
model = Pipeline(steps=(('scaler', scaler), ('dummy', dummy)))
101+
102+
run = self._perform_run(task_id, num_instances, model)
103+
self.assertEqual(len(run.trace_content), num_iterations * num_folds)
104+
89105
def test__run_task_get_arffcontent(self):
90106
task = openml.tasks.get_task(1939)
91107
class_labels = task.class_labels

0 commit comments

Comments
 (0)