-
-
Notifications
You must be signed in to change notification settings - Fork 270
Improve unit tests #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve unit tests #985
Changes from 11 commits
01a0c23
7173b5d
8e76fcd
0babe6a
7103338
de23931
60bd37a
bd5fb89
eb8f894
5cc97d1
39e2f07
4863c6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -442,7 +442,7 @@ def determine_grid_size(param_grid): | |
| # suboptimal (slow), and not guaranteed to work if evaluation | ||
| # engine is behind. | ||
| # TODO: mock this? We have the arff already on the server | ||
| self._wait_for_processed_run(run.run_id, 400) | ||
| self._wait_for_processed_run(run.run_id, 600) | ||
| try: | ||
| model_prime = openml.runs.initialize_model_from_trace( | ||
| run_id=run.run_id, repeat=0, fold=0, | ||
|
|
@@ -518,12 +518,14 @@ def _run_and_upload_regression( | |
| sentinel=sentinel, | ||
| ) | ||
|
|
||
| def test_run_and_upload_logistic_regression(self): | ||
| @unittest.mock.patch("warnings.warn") | ||
| def test_run_and_upload_logistic_regression(self, warn_mock): | ||
| lr = LogisticRegression(solver="lbfgs") | ||
| task_id = self.TEST_SERVER_TASK_SIMPLE[0] | ||
| n_missing_vals = self.TEST_SERVER_TASK_SIMPLE[1] | ||
| n_test_obs = self.TEST_SERVER_TASK_SIMPLE[2] | ||
| self._run_and_upload_classification(lr, task_id, n_missing_vals, n_test_obs, "62501") | ||
| self.assertLessEqual(warn_mock.call_count, 3) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please explain why we expect three warnings.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly, I don't understand the 3 myself and would have expected 1. I will simply increase the max_iter so this test passes.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I now understand. We call run_model_on_task once, and then twice a helper function called |
||
|
|
||
| def test_run_and_upload_linear_regression(self): | ||
| lr = LinearRegression() | ||
|
|
@@ -605,7 +607,8 @@ def get_ct_cf(nominal_indices, numeric_indices): | |
| LooseVersion(sklearn.__version__) < "0.20", | ||
| reason="columntransformer introduction in 0.20.0", | ||
| ) | ||
| def test_run_and_upload_knn_pipeline(self): | ||
| @unittest.mock.patch("warnings.warn") | ||
| def test_run_and_upload_knn_pipeline(self, warnings_mock): | ||
|
|
||
| cat_imp = make_pipeline( | ||
| SimpleImputer(strategy="most_frequent"), OneHotEncoder(handle_unknown="ignore") | ||
|
|
@@ -635,11 +638,13 @@ def test_run_and_upload_knn_pipeline(self): | |
| n_missing_vals = self.TEST_SERVER_TASK_MISSING_VALS[1] | ||
| n_test_obs = self.TEST_SERVER_TASK_MISSING_VALS[2] | ||
| self._run_and_upload_classification(pipeline2, task_id, n_missing_vals, n_test_obs, "62501") | ||
| self.assertEqual(warnings_mock.call_count, 3) | ||
|
PGijsbers marked this conversation as resolved.
|
||
|
|
||
| def test_run_and_upload_gridsearch(self): | ||
| gridsearch = GridSearchCV( | ||
| BaggingClassifier(base_estimator=SVC()), | ||
| {"base_estimator__C": [0.01, 0.1, 10], "base_estimator__gamma": [0.01, 0.1, 10]}, | ||
| cv=3, | ||
|
PGijsbers marked this conversation as resolved.
|
||
| ) | ||
| task_id = self.TEST_SERVER_TASK_SIMPLE[0] | ||
| n_missing_vals = self.TEST_SERVER_TASK_SIMPLE[1] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.