Skip to content
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

Make DefaultAlgorithm the default AutoML Algorithm #3261

Merged
merged 76 commits into from
Feb 14, 2022

Conversation

jeremyliweishih
Copy link
Collaborator

@jeremyliweishih jeremyliweishih commented Jan 19, 2022

Fixes #2867. Since there is a lot in this PR, I will use the PR for #2693 to fix docstrings and think about changes to AutoMLSearch API.

I will be doing the following in this PR:

  • justify why a test deserves a _iterative tag
  • moving such _iterative tests to their own files
  • generalize any tests I can to be algorithm agnostic

I will also create a list of tests that we can improve in #2868 with a MockAlgorithm with these following criteria:

  • test logic hinges on algorithm implementation (i.e number of pipelines and such)
  • I cannot generalize the test to work with both current algorithm implementations

List of tests that we can use a mock algorithm with:

1. test_automl_algorithm
2. test_time_series_regression_with_parameters
3. test_max_batches_works
4. test_callback (there’s multiple)
5. test_automl_tuner_exception
6. test_results_getter
7. test_automl_pipeline_params_kwargs
8. test_search_with_text_and_ensembling_iterative
9. test_pipelines_per_batch_iterative
10. test_automl_respects_random_seed_iterative
11. test_automl_respects_pipeline_parameters_with_duplicate_components_iterative
12. test_automl_respects_pipeline_custom_hyperparameters_with_duplicate_components_iterative
13. test_automl_search_sampler_ratio
14. test_automl_search_sampler_method
15. test_time_series_pipeline_parameter_warnings
16. test_pipeline_count

List of tests we can maybe generalize with much larger lift:

  • any tests with component graphs or iterative specific parameters

Performance tests vs. using top level search method (results are identical):
default_swap_com.html.zip

@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #3261 (7ba7992) into main (e06a912) will decrease coverage by 0.2%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3261     +/-   ##
=======================================
- Coverage   99.8%   99.7%   -0.1%     
=======================================
  Files        324     327      +3     
  Lines      31764   31814     +50     
=======================================
+ Hits       31674   31689     +15     
- Misses        90     125     +35     
Impacted Files Coverage Δ
evalml/automl/automl_algorithm/automl_algorithm.py 100.0% <100.0%> (ø)
...valml/automl/automl_algorithm/default_algorithm.py 100.0% <100.0%> (ø)
evalml/automl/automl_search.py 99.7% <100.0%> (-0.1%) ⬇️
...ts/automl_tests/parallel_tests/test_automl_dask.py 96.3% <100.0%> (-3.7%) ⬇️
evalml/tests/automl_tests/test_automl.py 99.5% <100.0%> (-0.1%) ⬇️
...ts/automl_tests/test_automl_iterative_algorithm.py 100.0% <100.0%> (ø)
.../automl_tests/test_automl_search_classification.py 96.4% <100.0%> (-3.6%) ⬇️
...sts/test_automl_search_classification_iterative.py 100.0% <100.0%> (ø)
...ests/automl_tests/test_automl_search_regression.py 94.7% <100.0%> (-5.3%) ⬇️
...l_tests/test_automl_search_regression_iterative.py 100.0% <100.0%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e06a912...7ba7992. Read the comment docs.

…ents to test_automl_respects_pipeline_parameters_with_duplicate_components_iterative and use iterative
…line_parameter_warnings_component_graphs_iterative and use iterative
Copy link
Contributor

@chukarsten chukarsten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeremy - great job here. I like what you're doing with the test refactoring and I think you're really hinting at the need to split integration vs. unit testing, which I think will require more planning and thought. It would be nice if we could get some of those coverage gaps filled, but I won't block on that. I think if you want to hit the ones that are low hanging fruit, that would be great.

@@ -446,7 +446,7 @@ def __init__(
allow_long_running_models=False,
_ensembling_split_size=0.2,
_pipelines_per_batch=5,
_automl_algorithm="iterative",
_automl_algorithm="default",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable.

"median",
]
assert 10 <= row["parameters"]["One Hot Encoder"]["top_n"] <= 12
assert automl._automl_algorithm._custom_hyperparameters == custom_hyperparameters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. So begins the work of disentangling unit tests from integration tests.

verbose=verbose,
)
env = AutoMLTestEnv("binary")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if "Mode Baseline Binary" in row["pipeline_name"]:
continue
if row["pipeline_name"] == "Name_linear":
assert row["parameters"]["Imputer"]["numeric_impute_strategy"] == "mean"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will require some investigation. We probably want to clear these up before we merge this PR. Maybe run these tests and see what is contained in row["pipeline_name"] to try and verify the intent of this line. I suspect this is the product of some naming rot as "Name_linear" doesn't look like anything I've seen, stylistically, since being here.

@jeremyliweishih
Copy link
Collaborator Author

@chukarsten I originally filed #3292 to fix the coverage issues but I'll see if I can get a quick win here!

Copy link
Contributor

@bchen1116 bchen1116 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Great work on pushing this forward, I just left a few nits/questions, but nothing blocking.

I know you've run some perf tests with the Default Algo before, but I think it could be useful to run perf tests on this PR versus current main, just to ensure there is no change in performance for peace of mind.

docs/source/release_notes.rst Outdated Show resolved Hide resolved
@@ -108,7 +108,13 @@ def test_pipeline_count(
else:
X, y = X_y_regression
if not allowed_families:
_ = AutoMLSearch(X_train=X, y_train=y, problem_type=type_, verbose=verbose)
_ = AutoMLSearch(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be addressed for default algo in a future PR?

* Change default max batches to fast mode

* Make automl_algorithm parameter public

* RL

* Fix release notes

* Add more logic to max_batches change

* Fix tests to work with new max batches

* Drop periods down to 100

* Add default max batches property to algos

* Lint

* Add time series logic to default max batches of default algo

* Fix test_max_batches_num_pipelines
@jeremyliweishih jeremyliweishih merged commit e67430c into main Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make DefaultAlgorithm the default AutoML Algorithm
3 participants