Skip to content

Add more doctests - #3002

Merged
ParthivNaresh merged 26 commits into
mainfrom
Add-More-Doctests
Nov 5, 2021
Merged

Add more doctests#3002
ParthivNaresh merged 26 commits into
mainfrom
Add-More-Doctests

Conversation

@ParthivNaresh

@ParthivNaresh ParthivNaresh commented Nov 2, 2021

Copy link
Copy Markdown
Contributor

Completes #2936

@codecov

codecov Bot commented Nov 2, 2021

Copy link
Copy Markdown

Codecov Report

Merging #3002 (142b92d) into main (8605ae4) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3002     +/-   ##
=======================================
+ Coverage   99.7%   99.7%   +0.1%     
=======================================
  Files        312     312             
  Lines      29853   29856      +3     
=======================================
+ Hits       29762   29765      +3     
  Misses        91      91             
Impacted Files Coverage Δ
evalml/data_checks/class_imbalance_data_check.py 100.0% <ø> (ø)
evalml/data_checks/datetime_format_data_check.py 100.0% <ø> (ø)
evalml/data_checks/datetime_nan_data_check.py 100.0% <ø> (ø)
evalml/data_checks/id_columns_data_check.py 100.0% <ø> (ø)
evalml/data_checks/invalid_targets_data_check.py 100.0% <ø> (ø)
evalml/data_checks/multicollinearity_data_check.py 100.0% <ø> (ø)
...lml/data_checks/natural_language_nan_data_check.py 100.0% <ø> (ø)
evalml/data_checks/no_variance_data_check.py 100.0% <ø> (ø)
evalml/data_checks/outliers_data_check.py 100.0% <ø> (ø)
...alml/data_checks/target_distribution_data_check.py 100.0% <ø> (ø)
... and 26 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 8605ae4...142b92d. Read the comment docs.

dict (DataCheckError): List with DataCheckErrors if unequal intervals are found in the datetime column.

Example:
Examples:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could just be personal opinion, but I think if we add this many examples (which is great!), it gets a little harder to read. Maybe what we need here is an extra line above each example to better understand what each example is trying to convey? From a quick glance, it's a bit hard to gauge the purpose of each example 😬

@ParthivNaresh ParthivNaresh Nov 4, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure thing, so maybe a comment above a doctest briefly explaining what it does?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exactly!

@freddyaboulton freddyaboulton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ParthivNaresh Thank you for this! This looks good to me. I agree with @angela97lin that since some docstrings test different things, it might be helpful to add some in-line comments above each one to document what's happening.

Other than that, I think it would be helpful if some of the assert float1 == float2 checks used rounding so that these don't start to flake if we're off by negligible amount in a future release.

metadata={"columns": too_sparse_cols},
).to_dict()
)
if too_sparse_cols:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How come we need to add this?

@ParthivNaresh ParthivNaresh Nov 5, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If none of the columns are returned from the sparsity_score, results still appends warning and actions. The warning message ends up being "Input columns ({}) for multiclass problem type are too sparse."

Comment thread evalml/data_checks/outliers_data_check.py Outdated
Comment thread evalml/objectives/standard_metrics.py Outdated
Comment thread evalml/objectives/utils.py
Examples:
>>> from evalml.pipelines.components.estimators.regressors.decision_tree_regressor import DecisionTreeRegressor
>>> assert generate_component_code(DecisionTreeRegressor()) == "from evalml.pipelines.components.estimators.regressors.decision_tree_regressor import DecisionTreeRegressor\n\ndecisionTreeRegressor = DecisionTreeRegressor(**{'criterion': 'mse', 'max_features': 'auto', 'max_depth': 6, 'min_samples_split': 2, 'min_weight_fraction_leaf': 0.0})"
...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Docs don't build without the r prefix? Is it cause of these three dots here? The example renders fine in the doc so I'm just wondering what happened but no need to change anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The lint check doesn't pass, I think due to the \n characters in the output

Comment thread evalml/preprocessing/utils.py Outdated
]
if len(highly_null_rows) > 0:
warning_msg = f"{len(highly_null_rows)} out of {len(X)} rows are more than {self.pct_null_row_threshold*100}% null"
warning_msg = f"{len(highly_null_rows)} out of {len(X)} rows are {self.pct_null_row_threshold*100}% or more null"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as in the sparsity data check: Just wondering we were modifying this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because the threshold check is percent_null_rows >= self.pct_null_row_threshold, so the phrasing or more seemed more appropriate than more than

@eccabay eccabay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What a beast of a change! Thanks for doing this, just left a few tiny tiny semantic nitpicks

Comment thread docs/source/release_notes.rst Outdated
Comment thread evalml/data_checks/multicollinearity_data_check.py Outdated
Comment thread evalml/data_checks/natural_language_nan_data_check.py Outdated
Comment thread evalml/data_checks/target_distribution_data_check.py
@ParthivNaresh
ParthivNaresh merged commit ca65539 into main Nov 5, 2021
@chukarsten chukarsten mentioned this pull request Nov 9, 2021
@freddyaboulton
freddyaboulton deleted the Add-More-Doctests branch May 13, 2022 15:23
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.

4 participants