Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Initial unit test design
  • Loading branch information
Neeratyoy committed Dec 9, 2020
commit 7d97fcde86766547d619e6cb74cee7495dbf721f
42 changes: 42 additions & 0 deletions tests/test_runs/test_run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,48 @@ def test_initialize_model_from_run(self):
self.assertEqual(flowS.components["Imputer"].parameters["strategy"], '"most_frequent"')
self.assertEqual(flowS.components["VarianceThreshold"].parameters["threshold"], "0.05")

@unittest.skipIf(
LooseVersion(sklearn.__version__) < "0.20",
reason="sklearn flows and pipelines changed drastically post 0.20 version",
)
def test_initialize_model_from_run_nonstrict(self):
# available runs on the test server, sorted based on the sklearn versions it uses
sklearn_runs = {
"sklearn==0.23.2": [
100,
111,
112,
120,
123,
130,
153,
164,
166,
167,
168,
803,
806,
807,
808,
814,
1373,
1374,
1375,
1376,
1377,
1378,
],
"sklearn==0.23.1": [386, 480, 512, 516, 520, 772, 1085, 1124, 1178, 1646],
"sklearn==0.20.2": [481],
"sklearn==0.22.2": [1108, 1612, 1642],
"sklearn==0.21.0": [1838],
}
current_version = "sklearn=={}".format(LooseVersion(sklearn.__version__).vstring)
sklearn_runs.pop(current_version)
version_choice = np.random.choice(list(sklearn_runs.keys()))
run_id_choice = np.random.choice(sklearn_runs[version_choice])
_ = openml.runs.initialize_model_from_run(run_id=run_id_choice, strict_version=False)

@unittest.skipIf(
LooseVersion(sklearn.__version__) < "0.20",
reason="SimpleImputer doesn't handle mixed type DataFrame as input",
Expand Down