diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index ef03cdf989..feec36a785 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -2,6 +2,7 @@ Release Notes ------------- **Future Releases** * Enhancements + * Reformatted files with updated black version :pr:`4395` * Fixes * Changes * Documentation Changes diff --git a/evalml/__init__.py b/evalml/__init__.py index 94bb6d970f..7642eacc81 100644 --- a/evalml/__init__.py +++ b/evalml/__init__.py @@ -1,4 +1,5 @@ """EvalML.""" + import warnings # hack to prevent warnings from skopt diff --git a/evalml/automl/__init__.py b/evalml/automl/__init__.py index 411fe6d502..43ec60f159 100644 --- a/evalml/automl/__init__.py +++ b/evalml/automl/__init__.py @@ -1,4 +1,5 @@ """AutoMLSearch and related modules.""" + from evalml.automl.automl_search import AutoMLSearch, search_iterative, search from evalml.automl.utils import ( get_default_primary_search_objective, diff --git a/evalml/automl/automl_algorithm/__init__.py b/evalml/automl/automl_algorithm/__init__.py index b29738d3d6..3588729e1c 100644 --- a/evalml/automl/automl_algorithm/__init__.py +++ b/evalml/automl/automl_algorithm/__init__.py @@ -1,4 +1,5 @@ """AutoML algorithms that power EvalML.""" + from evalml.automl.automl_algorithm.automl_algorithm import ( AutoMLAlgorithm, AutoMLAlgorithmException, diff --git a/evalml/automl/automl_algorithm/automl_algorithm.py b/evalml/automl/automl_algorithm/automl_algorithm.py index d5e2998629..4a549b32fe 100644 --- a/evalml/automl/automl_algorithm/automl_algorithm.py +++ b/evalml/automl/automl_algorithm/automl_algorithm.py @@ -1,4 +1,5 @@ """Base class for the AutoML algorithms which power EvalML.""" + import inspect from abc import ABC, abstractmethod diff --git a/evalml/automl/automl_algorithm/default_algorithm.py b/evalml/automl/automl_algorithm/default_algorithm.py index d6cb0b9aca..6f972b50f7 100644 --- a/evalml/automl/automl_algorithm/default_algorithm.py +++ b/evalml/automl/automl_algorithm/default_algorithm.py @@ -1,4 +1,5 @@ """An automl algorithm that consists of two modes: fast and long, where fast is a subset of long.""" + import logging import numpy as np diff --git a/evalml/automl/automl_algorithm/iterative_algorithm.py b/evalml/automl/automl_algorithm/iterative_algorithm.py index 2cb9281fd6..f4819ddeca 100644 --- a/evalml/automl/automl_algorithm/iterative_algorithm.py +++ b/evalml/automl/automl_algorithm/iterative_algorithm.py @@ -1,4 +1,5 @@ """An automl algorithm which first fits a base round of pipelines with default parameters, then does a round of parameter tuning on each pipeline in order of performance.""" + import logging import warnings from operator import itemgetter diff --git a/evalml/automl/automl_search.py b/evalml/automl/automl_search.py index c32e640222..313b32b408 100644 --- a/evalml/automl/automl_search.py +++ b/evalml/automl/automl_search.py @@ -1,4 +1,5 @@ """EvalML's core AutoML object.""" + import copy import logging import pickle diff --git a/evalml/automl/callbacks.py b/evalml/automl/callbacks.py index 5c83a683a5..0a2190f685 100644 --- a/evalml/automl/callbacks.py +++ b/evalml/automl/callbacks.py @@ -1,4 +1,5 @@ """Callbacks available to pass to AutoML.""" + import logging from evalml.exceptions import PipelineScoreError diff --git a/evalml/automl/engine/__init__.py b/evalml/automl/engine/__init__.py index 22cab6593d..cdbe64cea0 100644 --- a/evalml/automl/engine/__init__.py +++ b/evalml/automl/engine/__init__.py @@ -1,4 +1,5 @@ """EvalML Engine classes used to evaluate pipelines in AutoMLSearch.""" + from evalml.automl.engine.engine_base import ( EngineBase, EngineComputation, diff --git a/evalml/automl/engine/cf_engine.py b/evalml/automl/engine/cf_engine.py index 676de46aaf..74d22f2714 100644 --- a/evalml/automl/engine/cf_engine.py +++ b/evalml/automl/engine/cf_engine.py @@ -1,4 +1,5 @@ """Custom CFClient API to match Dask's CFClient and allow context management.""" + from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor from evalml.automl.engine.engine_base import ( diff --git a/evalml/automl/engine/dask_engine.py b/evalml/automl/engine/dask_engine.py index ceb481b74e..67f86b0837 100644 --- a/evalml/automl/engine/dask_engine.py +++ b/evalml/automl/engine/dask_engine.py @@ -1,4 +1,5 @@ """A Future-like wrapper around jobs created by the DaskEngine.""" + import joblib from dask.distributed import Client, LocalCluster diff --git a/evalml/automl/engine/engine_base.py b/evalml/automl/engine/engine_base.py index d011ec737c..cb5926e9ad 100644 --- a/evalml/automl/engine/engine_base.py +++ b/evalml/automl/engine/engine_base.py @@ -1,4 +1,5 @@ """Base class for EvalML engines.""" + import sys import time import traceback diff --git a/evalml/automl/engine/sequential_engine.py b/evalml/automl/engine/sequential_engine.py index d9dab0ee37..300d8be6c1 100644 --- a/evalml/automl/engine/sequential_engine.py +++ b/evalml/automl/engine/sequential_engine.py @@ -1,4 +1,5 @@ """A Future-like api for jobs created by the SequentialEngine, an Engine that sequentially computes the submitted jobs.""" + from evalml.automl.engine.engine_base import ( EngineBase, EngineComputation, diff --git a/evalml/automl/pipeline_search_plots.py b/evalml/automl/pipeline_search_plots.py index 0356be8f86..e8811fa387 100644 --- a/evalml/automl/pipeline_search_plots.py +++ b/evalml/automl/pipeline_search_plots.py @@ -1,4 +1,5 @@ """Plots displayed during pipeline search.""" + from evalml.utils import import_or_raise, jupyter_check diff --git a/evalml/automl/progress.py b/evalml/automl/progress.py index 130b140618..27d9d2c56d 100644 --- a/evalml/automl/progress.py +++ b/evalml/automl/progress.py @@ -1,4 +1,5 @@ """Progress abstraction holding stopping criteria and progress information.""" + import logging import time diff --git a/evalml/automl/utils.py b/evalml/automl/utils.py index 56331807b4..e6dc848e7d 100644 --- a/evalml/automl/utils.py +++ b/evalml/automl/utils.py @@ -1,4 +1,5 @@ """Utilities useful in AutoML.""" + from collections import namedtuple import pandas as pd diff --git a/evalml/data_checks/__init__.py b/evalml/data_checks/__init__.py index 458b106d99..a9f1dd2750 100644 --- a/evalml/data_checks/__init__.py +++ b/evalml/data_checks/__init__.py @@ -1,4 +1,5 @@ """Data checks.""" + from evalml.data_checks.data_check import DataCheck from evalml.data_checks.data_check_message_code import DataCheckMessageCode from evalml.data_checks.data_check_action import DataCheckAction diff --git a/evalml/data_checks/class_imbalance_data_check.py b/evalml/data_checks/class_imbalance_data_check.py index 223906bd64..7947bb9b07 100644 --- a/evalml/data_checks/class_imbalance_data_check.py +++ b/evalml/data_checks/class_imbalance_data_check.py @@ -2,6 +2,7 @@ Use for classification problems. """ + import numpy as np import pandas as pd diff --git a/evalml/data_checks/data_check.py b/evalml/data_checks/data_check.py index f67d1a0bf8..8bc3954f57 100644 --- a/evalml/data_checks/data_check.py +++ b/evalml/data_checks/data_check.py @@ -1,4 +1,5 @@ """Base class for all data checks.""" + from abc import ABC, abstractmethod from evalml.utils import classproperty diff --git a/evalml/data_checks/data_check_action.py b/evalml/data_checks/data_check_action.py index 75e23dd6e2..9e5985bc9d 100644 --- a/evalml/data_checks/data_check_action.py +++ b/evalml/data_checks/data_check_action.py @@ -74,7 +74,9 @@ def convert_dict_to_action(action_dict): return DataCheckAction( action_code=DataCheckActionCode._all_values[action_dict["code"]], metadata=action_dict["metadata"], - data_check_name=action_dict["data_check_name"] - if "data_check_name" in action_dict - else None, + data_check_name=( + action_dict["data_check_name"] + if "data_check_name" in action_dict + else None + ), ) diff --git a/evalml/data_checks/data_check_action_code.py b/evalml/data_checks/data_check_action_code.py index d0cf1e6b7b..65c3fc2218 100644 --- a/evalml/data_checks/data_check_action_code.py +++ b/evalml/data_checks/data_check_action_code.py @@ -1,4 +1,5 @@ """Enum for data check action code.""" + from enum import Enum from evalml.utils import classproperty diff --git a/evalml/data_checks/data_check_action_option.py b/evalml/data_checks/data_check_action_option.py index 4da76cc203..c34b9188c3 100644 --- a/evalml/data_checks/data_check_action_option.py +++ b/evalml/data_checks/data_check_action_option.py @@ -1,4 +1,5 @@ """Recommended action returned by a DataCheck.""" + from enum import Enum from evalml.data_checks.data_check_action import DataCheckAction @@ -124,12 +125,14 @@ def convert_dict_to_option(action_dict): return DataCheckActionOption( action_code=DataCheckActionCode._all_values[action_dict["code"]], metadata=action_dict["metadata"], - data_check_name=action_dict["data_check_name"] - if "data_check_name" in action_dict - else None, - parameters=action_dict["parameters"] - if "parameters" in action_dict - else None, + data_check_name=( + action_dict["data_check_name"] + if "data_check_name" in action_dict + else None + ), + parameters=( + action_dict["parameters"] if "parameters" in action_dict else None + ), ) def _validate_parameters(self): diff --git a/evalml/data_checks/data_check_message.py b/evalml/data_checks/data_check_message.py index f000bbad1e..3944dc9908 100644 --- a/evalml/data_checks/data_check_message.py +++ b/evalml/data_checks/data_check_message.py @@ -1,4 +1,5 @@ """Messages returned by a DataCheck, tagged by name.""" + from evalml.data_checks.data_check_message_type import DataCheckMessageType diff --git a/evalml/data_checks/data_check_message_code.py b/evalml/data_checks/data_check_message_code.py index 2b75a09929..3ded4fcca5 100644 --- a/evalml/data_checks/data_check_message_code.py +++ b/evalml/data_checks/data_check_message_code.py @@ -1,4 +1,5 @@ """Enum for data check message code.""" + from enum import Enum diff --git a/evalml/data_checks/data_check_message_type.py b/evalml/data_checks/data_check_message_type.py index 717f6b931e..8e10557ebb 100644 --- a/evalml/data_checks/data_check_message_type.py +++ b/evalml/data_checks/data_check_message_type.py @@ -1,4 +1,5 @@ """Enum for type of data check message.""" + from enum import Enum diff --git a/evalml/data_checks/data_checks.py b/evalml/data_checks/data_checks.py index 57bcc8d4f8..0911603d42 100644 --- a/evalml/data_checks/data_checks.py +++ b/evalml/data_checks/data_checks.py @@ -1,4 +1,5 @@ """A collection of data checks.""" + import inspect from evalml.data_checks import DataCheck diff --git a/evalml/data_checks/datetime_format_data_check.py b/evalml/data_checks/datetime_format_data_check.py index 9aaaac3244..d1d26f11b0 100644 --- a/evalml/data_checks/datetime_format_data_check.py +++ b/evalml/data_checks/datetime_format_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if the datetime column has equally spaced intervals and is monotonically increasing or decreasing in order to be supported by time series estimators.""" + import pandas as pd from woodwork.statistics_utils import infer_frequency @@ -448,9 +449,11 @@ def validate(self, X, y): series_message = f"Input datetime column '{col_name}' for series '{series}' contains NaN values. Please impute NaN values or drop these rows." messages.append( DataCheckError( - message=f"Input datetime column '{col_name}' contains NaN values. Please impute NaN values or drop these rows." - if not is_multiseries - else series_message, + message=( + f"Input datetime column '{col_name}' contains NaN values. Please impute NaN values or drop these rows." + if not is_multiseries + else series_message + ), data_check_name=self.name, message_code=DataCheckMessageCode.DATETIME_HAS_NAN, ).to_dict(), @@ -461,9 +464,11 @@ def validate(self, X, y): series_message = f"Column '{col_name}' for series '{series}' has more than one row with the same datetime value." messages.append( DataCheckError( - message=f"Column '{col_name}' has more than one row with the same datetime value." - if not is_multiseries - else series_message, + message=( + f"Column '{col_name}' has more than one row with the same datetime value." + if not is_multiseries + else series_message + ), data_check_name=self.name, message_code=DataCheckMessageCode.DATETIME_HAS_REDUNDANT_ROW, ).to_dict(), @@ -474,9 +479,11 @@ def validate(self, X, y): series_message = f"Column '{col_name}' for series '{series}' has datetime values missing between start and end date." messages.append( DataCheckError( - message=f"Column '{col_name}' has datetime values missing between start and end date." - if not is_multiseries - else series_message, + message=( + f"Column '{col_name}' has datetime values missing between start and end date." + if not is_multiseries + else series_message + ), data_check_name=self.name, message_code=DataCheckMessageCode.DATETIME_IS_MISSING_VALUES, ).to_dict(), @@ -487,9 +494,11 @@ def validate(self, X, y): series_message = f"Column '{col_name}' for series '{series}' has datetime values that do not align with the inferred frequency." messages.append( DataCheckError( - message=f"Column '{col_name}' has datetime values that do not align with the inferred frequency." - if not is_multiseries - else series_message, + message=( + f"Column '{col_name}' has datetime values that do not align with the inferred frequency." + if not is_multiseries + else series_message + ), data_check_name=self.name, message_code=DataCheckMessageCode.DATETIME_HAS_MISALIGNED_VALUES, ).to_dict(), @@ -505,9 +514,11 @@ def validate(self, X, y): series_message = f"No frequency could be detected in column '{col_name}' for series '{series}', possibly due to uneven intervals or too many duplicate/missing values." messages.append( DataCheckError( - message=f"No frequency could be detected in column '{col_name}', possibly due to uneven intervals or too many duplicate/missing values." - if not is_multiseries - else series_message, + message=( + f"No frequency could be detected in column '{col_name}', possibly due to uneven intervals or too many duplicate/missing values." + if not is_multiseries + else series_message + ), data_check_name=self.name, message_code=DataCheckMessageCode.DATETIME_NO_FREQUENCY_INFERRED, ).to_dict(), @@ -516,9 +527,11 @@ def validate(self, X, y): series_message = f"A frequency was detected in column '{col_name}' for series '{series}', but there are faulty datetime values that need to be addressed." messages.append( DataCheckError( - message=f"A frequency was detected in column '{col_name}', but there are faulty datetime values that need to be addressed." - if not is_multiseries - else series_message, + message=( + f"A frequency was detected in column '{col_name}', but there are faulty datetime values that need to be addressed." + if not is_multiseries + else series_message + ), data_check_name=self.name, message_code=DataCheckMessageCode.DATETIME_HAS_UNEVEN_INTERVALS, action_options=[ diff --git a/evalml/data_checks/default_data_checks.py b/evalml/data_checks/default_data_checks.py index 39f4443891..3069475b04 100644 --- a/evalml/data_checks/default_data_checks.py +++ b/evalml/data_checks/default_data_checks.py @@ -1,4 +1,5 @@ """A default set of data checks that can be used for a variety of datasets.""" + from evalml.data_checks.class_imbalance_data_check import ClassImbalanceDataCheck from evalml.data_checks.data_checks import DataChecks from evalml.data_checks.datetime_format_data_check import DateTimeFormatDataCheck diff --git a/evalml/data_checks/invalid_target_data_check.py b/evalml/data_checks/invalid_target_data_check.py index 225446d305..f67a26b779 100644 --- a/evalml/data_checks/invalid_target_data_check.py +++ b/evalml/data_checks/invalid_target_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if the target data contains missing or invalid values.""" + import woodwork as ww from evalml.data_checks import ( @@ -262,12 +263,16 @@ def _check_target_has_nan(self, y, messages): "impute_strategy": { "parameter_type": DCAOParameterType.GLOBAL, "type": "category", - "categories": ["mean", "most_frequent"] - if is_regression(self.problem_type) - else ["most_frequent"], - "default_value": "mean" - if is_regression(self.problem_type) - else "most_frequent", + "categories": ( + ["mean", "most_frequent"] + if is_regression(self.problem_type) + else ["most_frequent"] + ), + "default_value": ( + "mean" + if is_regression(self.problem_type) + else "most_frequent" + ), }, }, metadata={"is_target": True}, diff --git a/evalml/data_checks/multicollinearity_data_check.py b/evalml/data_checks/multicollinearity_data_check.py index 008a60cdfb..93774ab3c6 100644 --- a/evalml/data_checks/multicollinearity_data_check.py +++ b/evalml/data_checks/multicollinearity_data_check.py @@ -1,4 +1,5 @@ """Data check to check if any set features are likely to be multicollinear.""" + from evalml.data_checks import DataCheck, DataCheckMessageCode, DataCheckWarning from evalml.utils import infer_feature_types diff --git a/evalml/data_checks/no_variance_data_check.py b/evalml/data_checks/no_variance_data_check.py index d43f76c014..78eb9fd289 100644 --- a/evalml/data_checks/no_variance_data_check.py +++ b/evalml/data_checks/no_variance_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if the target or any of the features have no variance.""" + from evalml.data_checks import ( DataCheck, DataCheckActionCode, diff --git a/evalml/data_checks/null_data_check.py b/evalml/data_checks/null_data_check.py index 096f094b0a..b051cd2e38 100644 --- a/evalml/data_checks/null_data_check.py +++ b/evalml/data_checks/null_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if there are any highly-null columns and rows in the input.""" + from evalml.data_checks import ( DataCheck, DataCheckActionCode, diff --git a/evalml/data_checks/outliers_data_check.py b/evalml/data_checks/outliers_data_check.py index a3c4537120..d5e3091809 100644 --- a/evalml/data_checks/outliers_data_check.py +++ b/evalml/data_checks/outliers_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if there are any outliers in input data by using IQR to determine score anomalies.""" + import numpy as np from scipy.stats import gamma diff --git a/evalml/data_checks/sparsity_data_check.py b/evalml/data_checks/sparsity_data_check.py index 9107e1763a..01c4bbb733 100644 --- a/evalml/data_checks/sparsity_data_check.py +++ b/evalml/data_checks/sparsity_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if there are any columns with sparsely populated values in the input.""" + from evalml.data_checks import ( DataCheck, DataCheckActionCode, diff --git a/evalml/data_checks/target_distribution_data_check.py b/evalml/data_checks/target_distribution_data_check.py index 5420931c96..4ac085ccaa 100644 --- a/evalml/data_checks/target_distribution_data_check.py +++ b/evalml/data_checks/target_distribution_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if the target data contains certain distributions that may need to be transformed prior training to improve model performance.""" + import numpy as np import woodwork as ww from scipy.stats import jarque_bera, shapiro diff --git a/evalml/data_checks/target_leakage_data_check.py b/evalml/data_checks/target_leakage_data_check.py index 0dbb64877b..0c979aa93a 100644 --- a/evalml/data_checks/target_leakage_data_check.py +++ b/evalml/data_checks/target_leakage_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if any of the features are highly correlated with the target by using mutual information or Pearson correlation.""" + from woodwork.config import CONFIG_DEFAULTS from evalml.data_checks import ( diff --git a/evalml/data_checks/ts_parameters_data_check.py b/evalml/data_checks/ts_parameters_data_check.py index 1608122330..4451fa456a 100644 --- a/evalml/data_checks/ts_parameters_data_check.py +++ b/evalml/data_checks/ts_parameters_data_check.py @@ -1,4 +1,5 @@ """Data check that checks whether the time series parameters are compatible with the data size.""" + from evalml.data_checks import DataCheck, DataCheckError, DataCheckMessageCode from evalml.utils.gen_utils import ( are_ts_parameters_valid_for_split, diff --git a/evalml/data_checks/ts_splitting_data_check.py b/evalml/data_checks/ts_splitting_data_check.py index b05a60d633..79054629a6 100644 --- a/evalml/data_checks/ts_splitting_data_check.py +++ b/evalml/data_checks/ts_splitting_data_check.py @@ -1,4 +1,5 @@ """Data check that checks whether the time series training and validation splits have adequate class representation.""" + from sklearn.model_selection import TimeSeriesSplit as SkTimeSeriesSplit from evalml.data_checks import DataCheck, DataCheckError, DataCheckMessageCode diff --git a/evalml/data_checks/uniqueness_data_check.py b/evalml/data_checks/uniqueness_data_check.py index e69b7d7fd1..050c1862b2 100644 --- a/evalml/data_checks/uniqueness_data_check.py +++ b/evalml/data_checks/uniqueness_data_check.py @@ -1,4 +1,5 @@ """Data check that checks if there are any columns in the input that are either too unique for classification problems or not unique enough for regression problems.""" + from evalml.data_checks import ( DataCheck, DataCheckActionCode, diff --git a/evalml/data_checks/utils.py b/evalml/data_checks/utils.py index 3628f8ce3d..fc65b45c35 100644 --- a/evalml/data_checks/utils.py +++ b/evalml/data_checks/utils.py @@ -1,4 +1,5 @@ """Utility methods for the data checks in EvalML.""" + from evalml.data_checks.data_check_action_code import DataCheckActionCode diff --git a/evalml/demos/__init__.py b/evalml/demos/__init__.py index f393b2d06b..b9c8c0e812 100644 --- a/evalml/demos/__init__.py +++ b/evalml/demos/__init__.py @@ -1,4 +1,5 @@ """Demo datasets.""" + from evalml.demos.breast_cancer import load_breast_cancer from evalml.demos.diabetes import load_diabetes from evalml.demos.fraud import load_fraud diff --git a/evalml/demos/breast_cancer.py b/evalml/demos/breast_cancer.py index c0b225852e..53a7830c35 100644 --- a/evalml/demos/breast_cancer.py +++ b/evalml/demos/breast_cancer.py @@ -1,4 +1,5 @@ """Load the breast cancer dataset, which can be used for binary classification problems.""" + import woodwork as ww import evalml diff --git a/evalml/demos/churn.py b/evalml/demos/churn.py index ac8ae563e4..265e395e09 100644 --- a/evalml/demos/churn.py +++ b/evalml/demos/churn.py @@ -1,4 +1,5 @@ """Load the churn dataset, which can be used for binary classification problems.""" + import evalml from evalml.preprocessing import load_data diff --git a/evalml/demos/diabetes.py b/evalml/demos/diabetes.py index dc97685492..89ce9b91a4 100644 --- a/evalml/demos/diabetes.py +++ b/evalml/demos/diabetes.py @@ -1,4 +1,5 @@ """Load the diabetes dataset, which can be used for regression problems.""" + import pandas as pd import woodwork as ww from sklearn.preprocessing import scale diff --git a/evalml/demos/fraud.py b/evalml/demos/fraud.py index 0999631c02..7569450e39 100644 --- a/evalml/demos/fraud.py +++ b/evalml/demos/fraud.py @@ -1,4 +1,5 @@ """Load the credit card fraud dataset, which can be used for binary classification problems.""" + import evalml from evalml.preprocessing import load_data diff --git a/evalml/demos/weather.py b/evalml/demos/weather.py index fcac835471..284435becb 100644 --- a/evalml/demos/weather.py +++ b/evalml/demos/weather.py @@ -1,4 +1,5 @@ """The Australian daily-min-termperatures weather dataset.""" + import pandas as pd import evalml diff --git a/evalml/demos/wine.py b/evalml/demos/wine.py index cc38b32f86..445fc27185 100644 --- a/evalml/demos/wine.py +++ b/evalml/demos/wine.py @@ -1,4 +1,5 @@ """Load and return the wine dataset, which can be used for multiclass classification problems.""" + import woodwork as ww import evalml diff --git a/evalml/exceptions/__init__.py b/evalml/exceptions/__init__.py index f99ba26e19..e937327391 100644 --- a/evalml/exceptions/__init__.py +++ b/evalml/exceptions/__init__.py @@ -1,4 +1,5 @@ """Exceptions used in EvalML.""" + from evalml.exceptions.exceptions import ( MethodPropertyNotFoundError, PipelineNotFoundError, diff --git a/evalml/exceptions/exceptions.py b/evalml/exceptions/exceptions.py index 103239dae9..eac61ac88e 100644 --- a/evalml/exceptions/exceptions.py +++ b/evalml/exceptions/exceptions.py @@ -1,4 +1,5 @@ """Exceptions used in EvalML.""" + from enum import Enum diff --git a/evalml/model_family/__init__.py b/evalml/model_family/__init__.py index b4455a36e4..e60b7f4bb2 100644 --- a/evalml/model_family/__init__.py +++ b/evalml/model_family/__init__.py @@ -1,3 +1,4 @@ """Family of machine learning models.""" + from evalml.model_family.model_family import ModelFamily from evalml.model_family.utils import handle_model_family diff --git a/evalml/model_family/model_family.py b/evalml/model_family/model_family.py index 4451b2b388..9f0ac75d7f 100644 --- a/evalml/model_family/model_family.py +++ b/evalml/model_family/model_family.py @@ -1,4 +1,5 @@ """Enum for family of machine learning models.""" + from enum import Enum diff --git a/evalml/model_family/utils.py b/evalml/model_family/utils.py index ac566978e4..2478739763 100644 --- a/evalml/model_family/utils.py +++ b/evalml/model_family/utils.py @@ -1,4 +1,5 @@ """Utility methods for EvalML's model families.""" + from evalml.model_family.model_family import ModelFamily diff --git a/evalml/model_understanding/__init__.py b/evalml/model_understanding/__init__.py index fe94503148..46940d22ad 100644 --- a/evalml/model_understanding/__init__.py +++ b/evalml/model_understanding/__init__.py @@ -1,4 +1,5 @@ """Model understanding tools.""" + from evalml.model_understanding.visualizations import ( binary_objective_vs_threshold, get_linear_coefficients, diff --git a/evalml/model_understanding/_partial_dependence_utils.py b/evalml/model_understanding/_partial_dependence_utils.py index b097987681..bf690ffe37 100644 --- a/evalml/model_understanding/_partial_dependence_utils.py +++ b/evalml/model_understanding/_partial_dependence_utils.py @@ -4,6 +4,7 @@ own modification to better handle mixed data types in the grid as well as EvalML pipelines. """ + import numpy as np import pandas as pd import woodwork as ww diff --git a/evalml/model_understanding/decision_boundary.py b/evalml/model_understanding/decision_boundary.py index fa7488c617..34ca94c685 100644 --- a/evalml/model_understanding/decision_boundary.py +++ b/evalml/model_understanding/decision_boundary.py @@ -1,4 +1,5 @@ """Model Understanding for decision boundary on Binary Classification problems.""" + import json import numpy as np diff --git a/evalml/model_understanding/feature_explanations.py b/evalml/model_understanding/feature_explanations.py index e3450fbc3d..6ddadb6b03 100644 --- a/evalml/model_understanding/feature_explanations.py +++ b/evalml/model_understanding/feature_explanations.py @@ -1,4 +1,5 @@ """Human Readable Pipeline Explanations.""" + import pandas as pd import evalml diff --git a/evalml/model_understanding/force_plots.py b/evalml/model_understanding/force_plots.py index fcb3d83c4a..a809bc6bc4 100644 --- a/evalml/model_understanding/force_plots.py +++ b/evalml/model_understanding/force_plots.py @@ -1,4 +1,5 @@ """Force plots.""" + import numpy as np import shap from shap import initjs diff --git a/evalml/model_understanding/metrics.py b/evalml/model_understanding/metrics.py index e5276465b1..53f810d219 100644 --- a/evalml/model_understanding/metrics.py +++ b/evalml/model_understanding/metrics.py @@ -1,4 +1,5 @@ """Standard metrics used for model understanding.""" + import warnings import numpy as np @@ -115,9 +116,11 @@ def graph_confusion_matrix( title = "Confusion matrix{}{}".format( "" if title_addition is None else (" " + title_addition), - "" - if normalize_method is None - else (', normalized using method "' + normalize_method + '"'), + ( + "" + if normalize_method is None + else (', normalized using method "' + normalize_method + '"') + ), ) z_data, custom_data = ( (conf_mat, conf_mat_normalized) diff --git a/evalml/model_understanding/partial_dependence_functions.py b/evalml/model_understanding/partial_dependence_functions.py index 1b06ffa80b..4fa6ffbde3 100644 --- a/evalml/model_understanding/partial_dependence_functions.py +++ b/evalml/model_understanding/partial_dependence_functions.py @@ -1,4 +1,5 @@ """Top level functions for running partial dependence.""" + import warnings import numpy as np @@ -503,9 +504,11 @@ def graph_partial_dependence( ) xrange = _calculate_axis_range(x_scale_df) if not is_categorical else None yrange = _calculate_axis_range( - ice_data.drop("class_label", axis=1) - if ice_data is not None - else part_dep["partial_dependence"], + ( + ice_data.drop("class_label", axis=1) + if ice_data is not None + else part_dep["partial_dependence"] + ), ) fig.update_xaxes(title=title, range=xrange) fig.update_yaxes(range=yrange) diff --git a/evalml/model_understanding/permutation_importance.py b/evalml/model_understanding/permutation_importance.py index b08dde5e9d..1045d9f5c1 100644 --- a/evalml/model_understanding/permutation_importance.py +++ b/evalml/model_understanding/permutation_importance.py @@ -1,4 +1,5 @@ """Permutation importance methods.""" + import numpy as np import pandas as pd from joblib import Parallel, delayed diff --git a/evalml/model_understanding/prediction_explanations/__init__.py b/evalml/model_understanding/prediction_explanations/__init__.py index 19a5f7b085..61847a02bc 100644 --- a/evalml/model_understanding/prediction_explanations/__init__.py +++ b/evalml/model_understanding/prediction_explanations/__init__.py @@ -1,4 +1,5 @@ """Prediction explanation tools.""" + from evalml.model_understanding.prediction_explanations.explainers import ( explain_predictions_best_worst, explain_predictions, diff --git a/evalml/model_understanding/prediction_explanations/explainers.py b/evalml/model_understanding/prediction_explanations/explainers.py index 3ed2bb3d6d..36ce478300 100644 --- a/evalml/model_understanding/prediction_explanations/explainers.py +++ b/evalml/model_understanding/prediction_explanations/explainers.py @@ -1,4 +1,5 @@ """Prediction explanation tools.""" + import sys import traceback from collections import namedtuple diff --git a/evalml/model_understanding/visualizations.py b/evalml/model_understanding/visualizations.py index 2f9520e501..a87e7f411b 100644 --- a/evalml/model_understanding/visualizations.py +++ b/evalml/model_understanding/visualizations.py @@ -1,4 +1,5 @@ """Visualization functions for model understanding.""" + import copy import os from collections import OrderedDict diff --git a/evalml/objectives/__init__.py b/evalml/objectives/__init__.py index 0281d77dc7..473cbb2c8b 100644 --- a/evalml/objectives/__init__.py +++ b/evalml/objectives/__init__.py @@ -1,4 +1,5 @@ """EvalML standard and custom objectives.""" + from evalml.objectives.binary_classification_objective import ( BinaryClassificationObjective, ) diff --git a/evalml/objectives/binary_classification_objective.py b/evalml/objectives/binary_classification_objective.py index af40bf62ba..8ee3ba19e3 100644 --- a/evalml/objectives/binary_classification_objective.py +++ b/evalml/objectives/binary_classification_objective.py @@ -1,4 +1,5 @@ """Base class for all binary classification objectives.""" + import numpy as np from scipy.optimize import differential_evolution diff --git a/evalml/objectives/cost_benefit_matrix.py b/evalml/objectives/cost_benefit_matrix.py index ae561dfc81..d783a75eca 100644 --- a/evalml/objectives/cost_benefit_matrix.py +++ b/evalml/objectives/cost_benefit_matrix.py @@ -1,4 +1,5 @@ """Cost-benefit matrix objective.""" + import numpy as np import evalml diff --git a/evalml/objectives/fraud_cost.py b/evalml/objectives/fraud_cost.py index 6bbaccb477..8fdc7338ff 100644 --- a/evalml/objectives/fraud_cost.py +++ b/evalml/objectives/fraud_cost.py @@ -1,4 +1,5 @@ """Score the percentage of money lost of the total transaction amount process due to fraud.""" + from evalml.objectives.binary_classification_objective import ( BinaryClassificationObjective, ) diff --git a/evalml/objectives/lead_scoring.py b/evalml/objectives/lead_scoring.py index 3231a27898..a67948095e 100644 --- a/evalml/objectives/lead_scoring.py +++ b/evalml/objectives/lead_scoring.py @@ -1,4 +1,5 @@ """Lead scoring objective.""" + import math from evalml.objectives.binary_classification_objective import ( diff --git a/evalml/objectives/multiclass_classification_objective.py b/evalml/objectives/multiclass_classification_objective.py index a26f84fb0c..8071960599 100644 --- a/evalml/objectives/multiclass_classification_objective.py +++ b/evalml/objectives/multiclass_classification_objective.py @@ -1,4 +1,5 @@ """Base class for all multiclass classification objectives.""" + from evalml.objectives.objective_base import ObjectiveBase from evalml.problem_types import ProblemTypes diff --git a/evalml/objectives/objective_base.py b/evalml/objectives/objective_base.py index b32ee79fa1..31f8f90a08 100644 --- a/evalml/objectives/objective_base.py +++ b/evalml/objectives/objective_base.py @@ -1,4 +1,5 @@ """Base class for all objectives.""" + from abc import ABC, abstractmethod import numpy as np diff --git a/evalml/objectives/regression_objective.py b/evalml/objectives/regression_objective.py index a118d14b86..ad14d0e9c2 100644 --- a/evalml/objectives/regression_objective.py +++ b/evalml/objectives/regression_objective.py @@ -1,4 +1,5 @@ """Base class for all regression objectives.""" + from evalml.objectives.objective_base import ObjectiveBase from evalml.problem_types import ProblemTypes diff --git a/evalml/objectives/sensitivity_low_alert.py b/evalml/objectives/sensitivity_low_alert.py index 421b783f02..b6c638b03f 100644 --- a/evalml/objectives/sensitivity_low_alert.py +++ b/evalml/objectives/sensitivity_low_alert.py @@ -1,4 +1,5 @@ """Sensitivity at Low Alert Rates objective.""" + import logging import numpy as np diff --git a/evalml/objectives/standard_metrics.py b/evalml/objectives/standard_metrics.py index 584233f38b..be70727512 100644 --- a/evalml/objectives/standard_metrics.py +++ b/evalml/objectives/standard_metrics.py @@ -1,4 +1,5 @@ """Standard machine learning objective functions.""" + import warnings import numpy as np diff --git a/evalml/objectives/time_series_regression_objective.py b/evalml/objectives/time_series_regression_objective.py index fce9e7a6ca..daa4fb51d3 100644 --- a/evalml/objectives/time_series_regression_objective.py +++ b/evalml/objectives/time_series_regression_objective.py @@ -1,4 +1,5 @@ """Base class for all time series regression objectives.""" + from evalml.objectives.regression_objective import RegressionObjective from evalml.problem_types import ProblemTypes diff --git a/evalml/objectives/utils.py b/evalml/objectives/utils.py index a36bf8e263..b236862572 100644 --- a/evalml/objectives/utils.py +++ b/evalml/objectives/utils.py @@ -1,4 +1,5 @@ """Utility methods for EvalML objectives.""" + from evalml import objectives from evalml.exceptions import ObjectiveCreationError, ObjectiveNotFoundError from evalml.objectives.objective_base import ObjectiveBase diff --git a/evalml/pipelines/__init__.py b/evalml/pipelines/__init__.py index a17395d0d1..784e8046bd 100644 --- a/evalml/pipelines/__init__.py +++ b/evalml/pipelines/__init__.py @@ -1,4 +1,5 @@ """EvalML pipelines.""" + from evalml.pipelines.components import ( Estimator, OneHotEncoder, diff --git a/evalml/pipelines/binary_classification_pipeline.py b/evalml/pipelines/binary_classification_pipeline.py index 86f8e11520..e539f56cf9 100644 --- a/evalml/pipelines/binary_classification_pipeline.py +++ b/evalml/pipelines/binary_classification_pipeline.py @@ -1,4 +1,5 @@ """Pipeline subclass for all binary classification pipelines.""" + from evalml.objectives import get_objective from evalml.pipelines.binary_classification_pipeline_mixin import ( BinaryClassificationPipelineMixin, diff --git a/evalml/pipelines/classification_pipeline.py b/evalml/pipelines/classification_pipeline.py index 15bdb57a14..7a99de7f7a 100644 --- a/evalml/pipelines/classification_pipeline.py +++ b/evalml/pipelines/classification_pipeline.py @@ -1,4 +1,5 @@ """Pipeline subclass for all classification pipelines.""" + import numpy as np import pandas as pd diff --git a/evalml/pipelines/component_graph.py b/evalml/pipelines/component_graph.py index 0f3f4e5810..4d62b04856 100644 --- a/evalml/pipelines/component_graph.py +++ b/evalml/pipelines/component_graph.py @@ -1,4 +1,5 @@ """Component graph for a pipeline as a directed acyclic graph (DAG).""" + import inspect import warnings @@ -805,9 +806,13 @@ def graph(self, name=None, graph_format=None): # Reformat labels for nodes: cast values as strings, reformat floats to 2 decimal points and remove brackets from dictionary values so Digraph can parse it parameters = "\\l".join( [ - key + " : " + "{:0.2f}".format(val) - if (isinstance(val, float)) - else key + " : " + str(val).replace("{", "").replace("}", "") + ( + key + " : " + "{:0.2f}".format(val) + if (isinstance(val, float)) + else key + + " : " + + str(val).replace("{", "").replace("}", "") + ) for key, val in component_class.parameters.items() ], ) # noqa: W605 diff --git a/evalml/pipelines/components/__init__.py b/evalml/pipelines/components/__init__.py index f7977a03ef..605c1e32c2 100644 --- a/evalml/pipelines/components/__init__.py +++ b/evalml/pipelines/components/__init__.py @@ -1,4 +1,5 @@ """EvalML component classes.""" + from evalml.pipelines.components.component_base import ComponentBase, ComponentBaseMeta from evalml.pipelines.components.estimators import ( Estimator, diff --git a/evalml/pipelines/components/component_base.py b/evalml/pipelines/components/component_base.py index 3375ffd233..2335f7d564 100644 --- a/evalml/pipelines/components/component_base.py +++ b/evalml/pipelines/components/component_base.py @@ -1,4 +1,5 @@ """Base class for all components.""" + import copy from abc import ABC, abstractmethod diff --git a/evalml/pipelines/components/component_base_meta.py b/evalml/pipelines/components/component_base_meta.py index e73ee7f4e7..24c3a12da7 100644 --- a/evalml/pipelines/components/component_base_meta.py +++ b/evalml/pipelines/components/component_base_meta.py @@ -1,4 +1,5 @@ """Metaclass that overrides creating a new component by wrapping methods with validators and setters.""" + from functools import wraps from evalml.exceptions import ComponentNotYetFittedError diff --git a/evalml/pipelines/components/ensemble/__init__.py b/evalml/pipelines/components/ensemble/__init__.py index c54eae1834..cf16bc6a6c 100644 --- a/evalml/pipelines/components/ensemble/__init__.py +++ b/evalml/pipelines/components/ensemble/__init__.py @@ -1,4 +1,5 @@ """Ensemble components.""" + from evalml.pipelines.components.ensemble.stacked_ensemble_base import ( StackedEnsembleBase, ) diff --git a/evalml/pipelines/components/ensemble/stacked_ensemble_base.py b/evalml/pipelines/components/ensemble/stacked_ensemble_base.py index 983347ebd4..3fc97fb456 100644 --- a/evalml/pipelines/components/ensemble/stacked_ensemble_base.py +++ b/evalml/pipelines/components/ensemble/stacked_ensemble_base.py @@ -1,4 +1,5 @@ """Stacked Ensemble Base.""" + from evalml.model_family import ModelFamily from evalml.pipelines.components import Estimator from evalml.utils import classproperty diff --git a/evalml/pipelines/components/ensemble/stacked_ensemble_classifier.py b/evalml/pipelines/components/ensemble/stacked_ensemble_classifier.py index 92f58c5dc6..2cf8084201 100644 --- a/evalml/pipelines/components/ensemble/stacked_ensemble_classifier.py +++ b/evalml/pipelines/components/ensemble/stacked_ensemble_classifier.py @@ -1,4 +1,5 @@ """Stacked Ensemble Classifier.""" + from evalml.model_family import ModelFamily from evalml.pipelines.components import ElasticNetClassifier from evalml.pipelines.components.ensemble import StackedEnsembleBase diff --git a/evalml/pipelines/components/ensemble/stacked_ensemble_regressor.py b/evalml/pipelines/components/ensemble/stacked_ensemble_regressor.py index 6d69213432..d1980555db 100644 --- a/evalml/pipelines/components/ensemble/stacked_ensemble_regressor.py +++ b/evalml/pipelines/components/ensemble/stacked_ensemble_regressor.py @@ -1,4 +1,5 @@ """Stacked Ensemble Regressor.""" + from evalml.model_family import ModelFamily from evalml.pipelines.components import ElasticNetRegressor from evalml.pipelines.components.ensemble import StackedEnsembleBase diff --git a/evalml/pipelines/components/estimators/__init__.py b/evalml/pipelines/components/estimators/__init__.py index 1e1548150d..057bca0bb6 100644 --- a/evalml/pipelines/components/estimators/__init__.py +++ b/evalml/pipelines/components/estimators/__init__.py @@ -1,4 +1,5 @@ """EvalML estimator components.""" + from evalml.pipelines.components.estimators.estimator import Estimator from evalml.pipelines.components.estimators.classifiers import ( LogisticRegressionClassifier, diff --git a/evalml/pipelines/components/estimators/classifiers/__init__.py b/evalml/pipelines/components/estimators/classifiers/__init__.py index 1635c3245f..30f96e4013 100644 --- a/evalml/pipelines/components/estimators/classifiers/__init__.py +++ b/evalml/pipelines/components/estimators/classifiers/__init__.py @@ -1,4 +1,5 @@ """Classification model components.""" + from evalml.pipelines.components.estimators.classifiers.logistic_regression_classifier import ( LogisticRegressionClassifier, ) diff --git a/evalml/pipelines/components/estimators/classifiers/baseline_classifier.py b/evalml/pipelines/components/estimators/classifiers/baseline_classifier.py index 4cd164ecf5..d581af66a5 100644 --- a/evalml/pipelines/components/estimators/classifiers/baseline_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/baseline_classifier.py @@ -1,4 +1,5 @@ """Baseline classifier.""" + import numpy as np import pandas as pd diff --git a/evalml/pipelines/components/estimators/classifiers/catboost_classifier.py b/evalml/pipelines/components/estimators/classifiers/catboost_classifier.py index a3de4fcde1..fb97699377 100644 --- a/evalml/pipelines/components/estimators/classifiers/catboost_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/catboost_classifier.py @@ -1,4 +1,5 @@ """CatBoost Classifier, a classifier that uses gradient-boosting on decision trees. CatBoost is an open-source library and natively supports categorical features.""" + import copy import warnings diff --git a/evalml/pipelines/components/estimators/classifiers/decision_tree_classifier.py b/evalml/pipelines/components/estimators/classifiers/decision_tree_classifier.py index 911f2740ec..833e9dc81a 100644 --- a/evalml/pipelines/components/estimators/classifiers/decision_tree_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/decision_tree_classifier.py @@ -1,4 +1,5 @@ """Decision Tree Classifier.""" + from sklearn.tree import DecisionTreeClassifier as SKDecisionTreeClassifier from skopt.space import Integer diff --git a/evalml/pipelines/components/estimators/classifiers/elasticnet_classifier.py b/evalml/pipelines/components/estimators/classifiers/elasticnet_classifier.py index 7ae954d355..7f19549c9f 100644 --- a/evalml/pipelines/components/estimators/classifiers/elasticnet_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/elasticnet_classifier.py @@ -1,4 +1,5 @@ """Elastic Net Classifier. Uses Logistic Regression with elasticnet penalty as the base estimator.""" + import warnings import numpy as np diff --git a/evalml/pipelines/components/estimators/classifiers/et_classifier.py b/evalml/pipelines/components/estimators/classifiers/et_classifier.py index 0056211833..d4b462526b 100644 --- a/evalml/pipelines/components/estimators/classifiers/et_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/et_classifier.py @@ -1,4 +1,5 @@ """Extra Trees Classifier.""" + from sklearn.ensemble import ExtraTreesClassifier as SKExtraTreesClassifier from skopt.space import Integer diff --git a/evalml/pipelines/components/estimators/classifiers/kneighbors_classifier.py b/evalml/pipelines/components/estimators/classifiers/kneighbors_classifier.py index 443d97da3c..d31405f15d 100644 --- a/evalml/pipelines/components/estimators/classifiers/kneighbors_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/kneighbors_classifier.py @@ -1,4 +1,5 @@ """K-Nearest Neighbors Classifier.""" + import numpy as np import pandas as pd from sklearn.neighbors import KNeighborsClassifier as SKKNeighborsClassifier diff --git a/evalml/pipelines/components/estimators/classifiers/lightgbm_classifier.py b/evalml/pipelines/components/estimators/classifiers/lightgbm_classifier.py index 04190f901a..bf543271e8 100644 --- a/evalml/pipelines/components/estimators/classifiers/lightgbm_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/lightgbm_classifier.py @@ -1,4 +1,5 @@ """LightGBM Classifier.""" + import copy import numpy as np diff --git a/evalml/pipelines/components/estimators/classifiers/logistic_regression_classifier.py b/evalml/pipelines/components/estimators/classifiers/logistic_regression_classifier.py index a238e2a7e4..eae1bd5b48 100644 --- a/evalml/pipelines/components/estimators/classifiers/logistic_regression_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/logistic_regression_classifier.py @@ -1,4 +1,5 @@ """Logistic Regression Classifier.""" + import numpy as np import pandas as pd from sklearn.linear_model import LogisticRegression as SKLogisticRegression diff --git a/evalml/pipelines/components/estimators/classifiers/rf_classifier.py b/evalml/pipelines/components/estimators/classifiers/rf_classifier.py index 17050bc5f4..fbc3722955 100644 --- a/evalml/pipelines/components/estimators/classifiers/rf_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/rf_classifier.py @@ -1,4 +1,5 @@ """Random Forest Classifier.""" + from sklearn.ensemble import RandomForestClassifier as SKRandomForestClassifier from skopt.space import Integer diff --git a/evalml/pipelines/components/estimators/classifiers/svm_classifier.py b/evalml/pipelines/components/estimators/classifiers/svm_classifier.py index 0366fed5e8..237dbb139e 100644 --- a/evalml/pipelines/components/estimators/classifiers/svm_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/svm_classifier.py @@ -1,4 +1,5 @@ """Support Vector Machine Classifier.""" + import numpy as np from sklearn.svm import SVC from skopt.space import Real diff --git a/evalml/pipelines/components/estimators/classifiers/vowpal_wabbit_classifiers.py b/evalml/pipelines/components/estimators/classifiers/vowpal_wabbit_classifiers.py index 728b56c262..e8d3929c93 100644 --- a/evalml/pipelines/components/estimators/classifiers/vowpal_wabbit_classifiers.py +++ b/evalml/pipelines/components/estimators/classifiers/vowpal_wabbit_classifiers.py @@ -1,4 +1,5 @@ """Vowpal Wabbit Classifiers.""" + from abc import abstractmethod from skopt.space import Integer, Real diff --git a/evalml/pipelines/components/estimators/classifiers/xgboost_classifier.py b/evalml/pipelines/components/estimators/classifiers/xgboost_classifier.py index b152488a87..a8338f86f1 100644 --- a/evalml/pipelines/components/estimators/classifiers/xgboost_classifier.py +++ b/evalml/pipelines/components/estimators/classifiers/xgboost_classifier.py @@ -1,4 +1,5 @@ """XGBoost Classifier.""" + import numpy as np import pandas as pd from pandas.api.types import is_integer_dtype diff --git a/evalml/pipelines/components/estimators/estimator.py b/evalml/pipelines/components/estimators/estimator.py index 736772ecfb..64584d717a 100644 --- a/evalml/pipelines/components/estimators/estimator.py +++ b/evalml/pipelines/components/estimators/estimator.py @@ -1,4 +1,5 @@ """A component that fits and predicts given data.""" + from abc import abstractmethod from typing import Dict, List, Optional, Tuple, Type, Union diff --git a/evalml/pipelines/components/estimators/regressors/__init__.py b/evalml/pipelines/components/estimators/regressors/__init__.py index df439247e7..c6d36a800d 100644 --- a/evalml/pipelines/components/estimators/regressors/__init__.py +++ b/evalml/pipelines/components/estimators/regressors/__init__.py @@ -1,4 +1,5 @@ """Regression model components.""" + from evalml.pipelines.components.estimators.regressors.elasticnet_regressor import ( ElasticNetRegressor, ) diff --git a/evalml/pipelines/components/estimators/regressors/arima_regressor.py b/evalml/pipelines/components/estimators/regressors/arima_regressor.py index dc1e54f9c9..436231c7a4 100644 --- a/evalml/pipelines/components/estimators/regressors/arima_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/arima_regressor.py @@ -1,4 +1,5 @@ """Autoregressive Integrated Moving Average Model. The three parameters (p, d, q) are the AR order, the degree of differencing, and the MA order. More information here: https://www.statsmodels.org/devel/generated/statsmodels.tsa.arima.model.ARIMA.html.""" + from typing import Dict, Hashable, List, Optional, Tuple, Union import numpy as np diff --git a/evalml/pipelines/components/estimators/regressors/baseline_regressor.py b/evalml/pipelines/components/estimators/regressors/baseline_regressor.py index 4f1ff3ed50..8e0ca196d0 100644 --- a/evalml/pipelines/components/estimators/regressors/baseline_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/baseline_regressor.py @@ -1,4 +1,5 @@ """Baseline regressor that uses a simple strategy to make predictions. This is useful as a simple baseline regressor to compare with other regressors.""" + import numpy as np import pandas as pd diff --git a/evalml/pipelines/components/estimators/regressors/catboost_regressor.py b/evalml/pipelines/components/estimators/regressors/catboost_regressor.py index a1d854f4f0..5fbd0304e5 100644 --- a/evalml/pipelines/components/estimators/regressors/catboost_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/catboost_regressor.py @@ -1,4 +1,5 @@ """CatBoost Regressor, a regressor that uses gradient-boosting on decision trees. CatBoost is an open-source library and natively supports categorical features.""" + import copy import warnings diff --git a/evalml/pipelines/components/estimators/regressors/decision_tree_regressor.py b/evalml/pipelines/components/estimators/regressors/decision_tree_regressor.py index df6af93e8c..86bd87d8be 100644 --- a/evalml/pipelines/components/estimators/regressors/decision_tree_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/decision_tree_regressor.py @@ -1,4 +1,5 @@ """Decision Tree Regressor.""" + from sklearn.tree import DecisionTreeRegressor as SKDecisionTreeRegressor from skopt.space import Integer diff --git a/evalml/pipelines/components/estimators/regressors/elasticnet_regressor.py b/evalml/pipelines/components/estimators/regressors/elasticnet_regressor.py index 8cab2ad109..51a0797769 100644 --- a/evalml/pipelines/components/estimators/regressors/elasticnet_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/elasticnet_regressor.py @@ -1,4 +1,5 @@ """Elastic Net Regressor.""" + import pandas as pd from sklearn.linear_model import ElasticNet as SKElasticNet from skopt.space import Real diff --git a/evalml/pipelines/components/estimators/regressors/et_regressor.py b/evalml/pipelines/components/estimators/regressors/et_regressor.py index 81673715df..8f87b71d9e 100644 --- a/evalml/pipelines/components/estimators/regressors/et_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/et_regressor.py @@ -1,4 +1,5 @@ """Extra Trees Regressor.""" + from typing import Dict, List, Optional, Union import pandas as pd diff --git a/evalml/pipelines/components/estimators/regressors/lightgbm_regressor.py b/evalml/pipelines/components/estimators/regressors/lightgbm_regressor.py index d371267d98..5c6b0a6199 100644 --- a/evalml/pipelines/components/estimators/regressors/lightgbm_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/lightgbm_regressor.py @@ -1,4 +1,5 @@ """LightGBM Regressor.""" + import copy import pandas as pd diff --git a/evalml/pipelines/components/estimators/regressors/linear_regressor.py b/evalml/pipelines/components/estimators/regressors/linear_regressor.py index 15c95d4654..ebdd82d39f 100644 --- a/evalml/pipelines/components/estimators/regressors/linear_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/linear_regressor.py @@ -1,4 +1,5 @@ """Linear Regressor.""" + import pandas as pd from sklearn.linear_model import LinearRegression as SKLinearRegression diff --git a/evalml/pipelines/components/estimators/regressors/multiseries_time_series_baseline_regressor.py b/evalml/pipelines/components/estimators/regressors/multiseries_time_series_baseline_regressor.py index 80be329341..1f7cf2c717 100644 --- a/evalml/pipelines/components/estimators/regressors/multiseries_time_series_baseline_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/multiseries_time_series_baseline_regressor.py @@ -1,4 +1,5 @@ """Time series estimator that predicts using the naive forecasting approach.""" + import numpy as np import pandas as pd diff --git a/evalml/pipelines/components/estimators/regressors/prophet_regressor.py b/evalml/pipelines/components/estimators/regressors/prophet_regressor.py index 726997514a..5f945fb017 100644 --- a/evalml/pipelines/components/estimators/regressors/prophet_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/prophet_regressor.py @@ -1,4 +1,5 @@ """Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.""" + import copy from typing import Dict, Hashable, List, Optional, Union diff --git a/evalml/pipelines/components/estimators/regressors/rf_regressor.py b/evalml/pipelines/components/estimators/regressors/rf_regressor.py index 5ab13317d9..593c51bbfa 100644 --- a/evalml/pipelines/components/estimators/regressors/rf_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/rf_regressor.py @@ -1,4 +1,5 @@ """Random Forest Regressor.""" + from typing import Dict, List, Optional, Union import pandas as pd diff --git a/evalml/pipelines/components/estimators/regressors/svm_regressor.py b/evalml/pipelines/components/estimators/regressors/svm_regressor.py index b73ef4f8fb..6b794af9ef 100644 --- a/evalml/pipelines/components/estimators/regressors/svm_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/svm_regressor.py @@ -1,4 +1,5 @@ """Support Vector Machine Regressor.""" + import numpy as np from sklearn.svm import SVR from skopt.space import Real diff --git a/evalml/pipelines/components/estimators/regressors/time_series_baseline_estimator.py b/evalml/pipelines/components/estimators/regressors/time_series_baseline_estimator.py index 462b442d26..63d5b1024e 100644 --- a/evalml/pipelines/components/estimators/regressors/time_series_baseline_estimator.py +++ b/evalml/pipelines/components/estimators/regressors/time_series_baseline_estimator.py @@ -1,4 +1,5 @@ """Time series estimator that predicts using the naive forecasting approach.""" + import numpy as np from evalml.model_family import ModelFamily diff --git a/evalml/pipelines/components/estimators/regressors/varmax_regressor.py b/evalml/pipelines/components/estimators/regressors/varmax_regressor.py index 0c8c57d27c..c7716b6c8f 100644 --- a/evalml/pipelines/components/estimators/regressors/varmax_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/varmax_regressor.py @@ -1,4 +1,5 @@ """Vector Autoregressive Moving Average with eXogenous regressors model. The two parameters (p, q) are the AR order and the MA order. More information here: https://www.statsmodels.org/stable/generated/statsmodels.tsa.statespace.varmax.VARMAX.html.""" + from typing import Dict, Hashable, List, Optional, Union import numpy as np diff --git a/evalml/pipelines/components/estimators/regressors/vowpal_wabbit_regressor.py b/evalml/pipelines/components/estimators/regressors/vowpal_wabbit_regressor.py index 0b3f4b3279..079c6e260a 100644 --- a/evalml/pipelines/components/estimators/regressors/vowpal_wabbit_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/vowpal_wabbit_regressor.py @@ -1,4 +1,5 @@ """Vowpal Wabbit Regressor.""" + from skopt.space import Integer, Real from evalml.model_family import ModelFamily diff --git a/evalml/pipelines/components/estimators/regressors/xgboost_regressor.py b/evalml/pipelines/components/estimators/regressors/xgboost_regressor.py index 3f06e4310e..f155c357dc 100644 --- a/evalml/pipelines/components/estimators/regressors/xgboost_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/xgboost_regressor.py @@ -1,4 +1,5 @@ """XGBoost Regressor.""" + from typing import Dict, List, Optional, Union import pandas as pd diff --git a/evalml/pipelines/components/transformers/__init__.py b/evalml/pipelines/components/transformers/__init__.py index fe87c29542..65b32d1b81 100644 --- a/evalml/pipelines/components/transformers/__init__.py +++ b/evalml/pipelines/components/transformers/__init__.py @@ -1,4 +1,5 @@ """Components that transform data.""" + from evalml.pipelines.components.transformers.transformer import Transformer from evalml.pipelines.components.transformers.encoders import ( OneHotEncoder, diff --git a/evalml/pipelines/components/transformers/column_selectors.py b/evalml/pipelines/components/transformers/column_selectors.py index d4939a221f..c0af75f341 100644 --- a/evalml/pipelines/components/transformers/column_selectors.py +++ b/evalml/pipelines/components/transformers/column_selectors.py @@ -1,4 +1,5 @@ """Initalizes an transformer that selects specified columns in input data.""" + from abc import abstractmethod from evalml.pipelines.components.transformers import Transformer diff --git a/evalml/pipelines/components/transformers/dimensionality_reduction/__init__.py b/evalml/pipelines/components/transformers/dimensionality_reduction/__init__.py index 328aecd609..fcc889c9ed 100644 --- a/evalml/pipelines/components/transformers/dimensionality_reduction/__init__.py +++ b/evalml/pipelines/components/transformers/dimensionality_reduction/__init__.py @@ -1,4 +1,5 @@ """Transformers that reduce the dimensionality of the input data.""" + from evalml.pipelines.components.transformers.dimensionality_reduction.lda import ( LinearDiscriminantAnalysis, ) diff --git a/evalml/pipelines/components/transformers/dimensionality_reduction/lda.py b/evalml/pipelines/components/transformers/dimensionality_reduction/lda.py index ae24a47851..c8579c48dc 100644 --- a/evalml/pipelines/components/transformers/dimensionality_reduction/lda.py +++ b/evalml/pipelines/components/transformers/dimensionality_reduction/lda.py @@ -1,4 +1,5 @@ """Component that reduces the number of features by using Linear Discriminant Analysis.""" + import pandas as pd from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as SkLDA diff --git a/evalml/pipelines/components/transformers/dimensionality_reduction/pca.py b/evalml/pipelines/components/transformers/dimensionality_reduction/pca.py index 165503627f..683618515a 100644 --- a/evalml/pipelines/components/transformers/dimensionality_reduction/pca.py +++ b/evalml/pipelines/components/transformers/dimensionality_reduction/pca.py @@ -1,4 +1,5 @@ """Component that reduces the number of features by using Principal Component Analysis (PCA).""" + import pandas as pd from sklearn.decomposition import PCA as SkPCA from skopt.space import Real diff --git a/evalml/pipelines/components/transformers/encoders/__init__.py b/evalml/pipelines/components/transformers/encoders/__init__.py index 7584b45ce9..0f0fd12206 100644 --- a/evalml/pipelines/components/transformers/encoders/__init__.py +++ b/evalml/pipelines/components/transformers/encoders/__init__.py @@ -1,4 +1,5 @@ """Components used to encode the input data.""" + from evalml.pipelines.components.transformers.encoders.onehot_encoder import ( OneHotEncoder, ) diff --git a/evalml/pipelines/components/transformers/encoders/label_encoder.py b/evalml/pipelines/components/transformers/encoders/label_encoder.py index fef365e303..a2520c4df6 100644 --- a/evalml/pipelines/components/transformers/encoders/label_encoder.py +++ b/evalml/pipelines/components/transformers/encoders/label_encoder.py @@ -1,4 +1,5 @@ """A transformer that encodes target labels using values between 0 and num_classes - 1.""" + import woodwork as ww from evalml.pipelines.components.transformers.transformer import Transformer diff --git a/evalml/pipelines/components/transformers/encoders/onehot_encoder.py b/evalml/pipelines/components/transformers/encoders/onehot_encoder.py index 434c4081d6..f182e59813 100644 --- a/evalml/pipelines/components/transformers/encoders/onehot_encoder.py +++ b/evalml/pipelines/components/transformers/encoders/onehot_encoder.py @@ -1,4 +1,5 @@ """A transformer that encodes categorical features in a one-hot numeric array.""" + import numpy as np import pandas as pd import woodwork as ww diff --git a/evalml/pipelines/components/transformers/encoders/ordinal_encoder.py b/evalml/pipelines/components/transformers/encoders/ordinal_encoder.py index 937dfa0823..980a8f416f 100644 --- a/evalml/pipelines/components/transformers/encoders/ordinal_encoder.py +++ b/evalml/pipelines/components/transformers/encoders/ordinal_encoder.py @@ -1,4 +1,5 @@ """A transformer that encodes ordinal features as an array of ordinal integers representing the relative order of categories.""" + import numpy as np import pandas as pd import woodwork as ww diff --git a/evalml/pipelines/components/transformers/encoders/target_encoder.py b/evalml/pipelines/components/transformers/encoders/target_encoder.py index 8a8ac93ea5..9e166bad83 100644 --- a/evalml/pipelines/components/transformers/encoders/target_encoder.py +++ b/evalml/pipelines/components/transformers/encoders/target_encoder.py @@ -1,4 +1,5 @@ """A transformer that encodes categorical features into target encodings.""" + import warnings import pandas as pd diff --git a/evalml/pipelines/components/transformers/feature_selection/__init__.py b/evalml/pipelines/components/transformers/feature_selection/__init__.py index 279dd39ab0..6b759577f7 100644 --- a/evalml/pipelines/components/transformers/feature_selection/__init__.py +++ b/evalml/pipelines/components/transformers/feature_selection/__init__.py @@ -1,4 +1,5 @@ """Components that select features.""" + from evalml.pipelines.components.transformers.feature_selection.feature_selector import ( FeatureSelector, ) diff --git a/evalml/pipelines/components/transformers/feature_selection/feature_selector.py b/evalml/pipelines/components/transformers/feature_selection/feature_selector.py index 65bb0f147a..736e320794 100644 --- a/evalml/pipelines/components/transformers/feature_selection/feature_selector.py +++ b/evalml/pipelines/components/transformers/feature_selection/feature_selector.py @@ -1,4 +1,5 @@ """Component that selects top features based on importance weights.""" + import pandas as pd from evalml.exceptions import MethodPropertyNotFoundError diff --git a/evalml/pipelines/components/transformers/feature_selection/recursive_feature_elimination_selector.py b/evalml/pipelines/components/transformers/feature_selection/recursive_feature_elimination_selector.py index 63fb699787..9b52a76225 100644 --- a/evalml/pipelines/components/transformers/feature_selection/recursive_feature_elimination_selector.py +++ b/evalml/pipelines/components/transformers/feature_selection/recursive_feature_elimination_selector.py @@ -1,4 +1,5 @@ """Components that select top features based on recursive feature elimination with a Random Forest model.""" + from abc import abstractmethod from sklearn.ensemble import RandomForestClassifier as SKRandomForestClassifier diff --git a/evalml/pipelines/components/transformers/feature_selection/rf_classifier_feature_selector.py b/evalml/pipelines/components/transformers/feature_selection/rf_classifier_feature_selector.py index 1cc5504167..1496e78cca 100644 --- a/evalml/pipelines/components/transformers/feature_selection/rf_classifier_feature_selector.py +++ b/evalml/pipelines/components/transformers/feature_selection/rf_classifier_feature_selector.py @@ -1,4 +1,5 @@ """Component that selects top features based on importance weights using a Random Forest classifier.""" + from sklearn.ensemble import RandomForestClassifier as SKRandomForestClassifier from sklearn.feature_selection import SelectFromModel as SkSelect from skopt.space import Real diff --git a/evalml/pipelines/components/transformers/feature_selection/rf_regressor_feature_selector.py b/evalml/pipelines/components/transformers/feature_selection/rf_regressor_feature_selector.py index 15b8dd5694..cb349f12e5 100644 --- a/evalml/pipelines/components/transformers/feature_selection/rf_regressor_feature_selector.py +++ b/evalml/pipelines/components/transformers/feature_selection/rf_regressor_feature_selector.py @@ -1,4 +1,5 @@ """Component that selects top features based on importance weights using a Random Forest regresor.""" + from sklearn.ensemble import RandomForestRegressor as SKRandomForestRegressor from sklearn.feature_selection import SelectFromModel as SkSelect from skopt.space import Real diff --git a/evalml/pipelines/components/transformers/imputers/__init__.py b/evalml/pipelines/components/transformers/imputers/__init__.py index df21f76a2f..f19609edb5 100644 --- a/evalml/pipelines/components/transformers/imputers/__init__.py +++ b/evalml/pipelines/components/transformers/imputers/__init__.py @@ -1,4 +1,5 @@ """Components that impute missing values in the input data.""" + from evalml.pipelines.components.transformers.imputers.per_column_imputer import ( PerColumnImputer, ) diff --git a/evalml/pipelines/components/transformers/imputers/imputer.py b/evalml/pipelines/components/transformers/imputers/imputer.py index 5aba00a3b1..76e37ad7af 100644 --- a/evalml/pipelines/components/transformers/imputers/imputer.py +++ b/evalml/pipelines/components/transformers/imputers/imputer.py @@ -1,4 +1,5 @@ """Component that imputes missing data according to a specified imputation strategy.""" + import pandas as pd from evalml.pipelines.components.transformers import Transformer diff --git a/evalml/pipelines/components/transformers/imputers/knn_imputer.py b/evalml/pipelines/components/transformers/imputers/knn_imputer.py index e34fd57d07..f2c63de7f7 100644 --- a/evalml/pipelines/components/transformers/imputers/knn_imputer.py +++ b/evalml/pipelines/components/transformers/imputers/knn_imputer.py @@ -1,4 +1,5 @@ """Component that imputes missing data according to a specified imputation strategy.""" + import numpy as np import pandas as pd import woodwork diff --git a/evalml/pipelines/components/transformers/imputers/per_column_imputer.py b/evalml/pipelines/components/transformers/imputers/per_column_imputer.py index b73c3d2ba3..214309b604 100644 --- a/evalml/pipelines/components/transformers/imputers/per_column_imputer.py +++ b/evalml/pipelines/components/transformers/imputers/per_column_imputer.py @@ -1,4 +1,5 @@ """Component that imputes missing data according to a specified imputation strategy per column.""" + import warnings from evalml.pipelines.components.transformers import Transformer diff --git a/evalml/pipelines/components/transformers/imputers/simple_imputer.py b/evalml/pipelines/components/transformers/imputers/simple_imputer.py index 84d49e04ac..35c93adcbd 100644 --- a/evalml/pipelines/components/transformers/imputers/simple_imputer.py +++ b/evalml/pipelines/components/transformers/imputers/simple_imputer.py @@ -1,4 +1,5 @@ """Component that imputes missing data according to a specified imputation strategy.""" + import pandas as pd import woodwork from sklearn.impute import SimpleImputer as SkImputer diff --git a/evalml/pipelines/components/transformers/imputers/target_imputer.py b/evalml/pipelines/components/transformers/imputers/target_imputer.py index f6fbe9231f..458f9b858b 100644 --- a/evalml/pipelines/components/transformers/imputers/target_imputer.py +++ b/evalml/pipelines/components/transformers/imputers/target_imputer.py @@ -1,4 +1,5 @@ """Component that imputes missing target data according to a specified imputation strategy.""" + from functools import wraps import pandas as pd diff --git a/evalml/pipelines/components/transformers/imputers/time_series_imputer.py b/evalml/pipelines/components/transformers/imputers/time_series_imputer.py index e8d15f89d6..70a536e275 100644 --- a/evalml/pipelines/components/transformers/imputers/time_series_imputer.py +++ b/evalml/pipelines/components/transformers/imputers/time_series_imputer.py @@ -1,4 +1,5 @@ """Component that imputes missing data according to a specified timeseries-specific imputation strategy.""" + import pandas as pd import woodwork as ww from woodwork.logical_types import ( diff --git a/evalml/pipelines/components/transformers/preprocessing/__init__.py b/evalml/pipelines/components/transformers/preprocessing/__init__.py index 6fbb8da311..287d1c6295 100644 --- a/evalml/pipelines/components/transformers/preprocessing/__init__.py +++ b/evalml/pipelines/components/transformers/preprocessing/__init__.py @@ -1,4 +1,5 @@ """Preprocessing transformer components.""" + from evalml.pipelines.components.transformers.preprocessing.datetime_featurizer import ( DateTimeFeaturizer, ) diff --git a/evalml/pipelines/components/transformers/preprocessing/datetime_featurizer.py b/evalml/pipelines/components/transformers/preprocessing/datetime_featurizer.py index d640bce295..6b35a12667 100644 --- a/evalml/pipelines/components/transformers/preprocessing/datetime_featurizer.py +++ b/evalml/pipelines/components/transformers/preprocessing/datetime_featurizer.py @@ -1,4 +1,5 @@ """Transformer that can automatically extract features from datetime columns.""" + import numpy as np import pandas as pd import woodwork as ww diff --git a/evalml/pipelines/components/transformers/preprocessing/decomposer.py b/evalml/pipelines/components/transformers/preprocessing/decomposer.py index 10222b3fc7..3a9eab3eea 100644 --- a/evalml/pipelines/components/transformers/preprocessing/decomposer.py +++ b/evalml/pipelines/components/transformers/preprocessing/decomposer.py @@ -1,4 +1,5 @@ """Component that removes trends from time series and returns the decomposed components.""" + from __future__ import annotations import re diff --git a/evalml/pipelines/components/transformers/preprocessing/drop_nan_rows_transformer.py b/evalml/pipelines/components/transformers/preprocessing/drop_nan_rows_transformer.py index b71d4eb9e8..4e6f03ee24 100644 --- a/evalml/pipelines/components/transformers/preprocessing/drop_nan_rows_transformer.py +++ b/evalml/pipelines/components/transformers/preprocessing/drop_nan_rows_transformer.py @@ -1,4 +1,5 @@ """Transformer to drop rows specified by row indices.""" + import pandas as pd from woodwork import init_series diff --git a/evalml/pipelines/components/transformers/preprocessing/drop_null_columns.py b/evalml/pipelines/components/transformers/preprocessing/drop_null_columns.py index 89fa58e5fc..fb9a34359a 100644 --- a/evalml/pipelines/components/transformers/preprocessing/drop_null_columns.py +++ b/evalml/pipelines/components/transformers/preprocessing/drop_null_columns.py @@ -1,4 +1,5 @@ """Transformer to drop features whose percentage of NaN values exceeds a specified threshold.""" + from evalml.pipelines.components.transformers import Transformer from evalml.utils import infer_feature_types diff --git a/evalml/pipelines/components/transformers/preprocessing/drop_rows_transformer.py b/evalml/pipelines/components/transformers/preprocessing/drop_rows_transformer.py index b03e9f5754..6558465512 100644 --- a/evalml/pipelines/components/transformers/preprocessing/drop_rows_transformer.py +++ b/evalml/pipelines/components/transformers/preprocessing/drop_rows_transformer.py @@ -1,4 +1,5 @@ """Transformer to drop rows specified by row indices.""" + from evalml.pipelines.components.transformers import Transformer from evalml.utils import infer_feature_types diff --git a/evalml/pipelines/components/transformers/preprocessing/featuretools.py b/evalml/pipelines/components/transformers/preprocessing/featuretools.py index e530ba214f..45c1c62678 100644 --- a/evalml/pipelines/components/transformers/preprocessing/featuretools.py +++ b/evalml/pipelines/components/transformers/preprocessing/featuretools.py @@ -1,4 +1,5 @@ """Featuretools DFS component that generates features for the input features.""" + from typing import List, Optional from featuretools import EntitySet, calculate_feature_matrix, dfs @@ -157,7 +158,9 @@ def _handle_partial_dependence_fast_mode(pipeline_parameters, X, target): if ( dfs_features is None or not DFSTransformer.contains_pre_existing_features( - dfs_features, list(X.columns), target + dfs_features, + list(X.columns), + target, ) ): raise ValueError( diff --git a/evalml/pipelines/components/transformers/preprocessing/log_transformer.py b/evalml/pipelines/components/transformers/preprocessing/log_transformer.py index 3bbc099b97..5852c4c3b8 100644 --- a/evalml/pipelines/components/transformers/preprocessing/log_transformer.py +++ b/evalml/pipelines/components/transformers/preprocessing/log_transformer.py @@ -1,4 +1,5 @@ """Component that applies a log transformation to the target data.""" + import numpy as np import pandas as pd diff --git a/evalml/pipelines/components/transformers/preprocessing/lsa.py b/evalml/pipelines/components/transformers/preprocessing/lsa.py index 2ebc6d874d..4c541ce1f8 100644 --- a/evalml/pipelines/components/transformers/preprocessing/lsa.py +++ b/evalml/pipelines/components/transformers/preprocessing/lsa.py @@ -1,4 +1,5 @@ """Transformer to calculate the Latent Semantic Analysis Values of text input.""" + import pandas as pd from sklearn.decomposition import TruncatedSVD from sklearn.feature_extraction.text import TfidfVectorizer diff --git a/evalml/pipelines/components/transformers/preprocessing/natural_language_featurizer.py b/evalml/pipelines/components/transformers/preprocessing/natural_language_featurizer.py index 7a4fc2ed8a..a57d2dccca 100644 --- a/evalml/pipelines/components/transformers/preprocessing/natural_language_featurizer.py +++ b/evalml/pipelines/components/transformers/preprocessing/natural_language_featurizer.py @@ -1,4 +1,5 @@ """Transformer that can automatically featurize text columns using featuretools' nlp_primitives.""" + import string import featuretools as ft diff --git a/evalml/pipelines/components/transformers/preprocessing/polynomial_decomposer.py b/evalml/pipelines/components/transformers/preprocessing/polynomial_decomposer.py index f2ffb93366..f6c81aa960 100644 --- a/evalml/pipelines/components/transformers/preprocessing/polynomial_decomposer.py +++ b/evalml/pipelines/components/transformers/preprocessing/polynomial_decomposer.py @@ -1,4 +1,5 @@ """Component that removes trends from time series by fitting a polynomial to the data.""" + from __future__ import annotations import logging diff --git a/evalml/pipelines/components/transformers/preprocessing/replace_nullable_types.py b/evalml/pipelines/components/transformers/preprocessing/replace_nullable_types.py index f76dc6915f..d311650bff 100644 --- a/evalml/pipelines/components/transformers/preprocessing/replace_nullable_types.py +++ b/evalml/pipelines/components/transformers/preprocessing/replace_nullable_types.py @@ -1,4 +1,5 @@ """Transformer to replace features with the new nullable dtypes with a dtype that is compatible in EvalML.""" + from woodwork import init_series from woodwork.logical_types import BooleanNullable, IntegerNullable diff --git a/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py b/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py index 76b8f4f3c4..e3f462dd23 100644 --- a/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py +++ b/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py @@ -1,4 +1,5 @@ """Component that removes trends and seasonality from time series using STL.""" + from __future__ import annotations import logging diff --git a/evalml/pipelines/components/transformers/preprocessing/text_transformer.py b/evalml/pipelines/components/transformers/preprocessing/text_transformer.py index 7ac507bd92..59b2ecab55 100644 --- a/evalml/pipelines/components/transformers/preprocessing/text_transformer.py +++ b/evalml/pipelines/components/transformers/preprocessing/text_transformer.py @@ -1,4 +1,5 @@ """Base class for all transformers working with text features.""" + from evalml.pipelines.components.transformers import Transformer diff --git a/evalml/pipelines/components/transformers/preprocessing/time_series_featurizer.py b/evalml/pipelines/components/transformers/preprocessing/time_series_featurizer.py index bbd35cc1e7..348509ce02 100644 --- a/evalml/pipelines/components/transformers/preprocessing/time_series_featurizer.py +++ b/evalml/pipelines/components/transformers/preprocessing/time_series_featurizer.py @@ -1,4 +1,5 @@ """Transformer that delays input features and target variable for time series problems.""" + import numpy as np import pandas as pd import woodwork as ww diff --git a/evalml/pipelines/components/transformers/preprocessing/time_series_regularizer.py b/evalml/pipelines/components/transformers/preprocessing/time_series_regularizer.py index 48eaa46594..2e30996ade 100644 --- a/evalml/pipelines/components/transformers/preprocessing/time_series_regularizer.py +++ b/evalml/pipelines/components/transformers/preprocessing/time_series_regularizer.py @@ -1,4 +1,5 @@ """Transformer that regularizes a dataset with an uninferrable offset frequency for time series problems.""" + import pandas as pd from woodwork.logical_types import Datetime from woodwork.statistics_utils import infer_frequency diff --git a/evalml/pipelines/components/transformers/preprocessing/transform_primitive_components.py b/evalml/pipelines/components/transformers/preprocessing/transform_primitive_components.py index d7597beb12..7cdd649a18 100644 --- a/evalml/pipelines/components/transformers/preprocessing/transform_primitive_components.py +++ b/evalml/pipelines/components/transformers/preprocessing/transform_primitive_components.py @@ -1,4 +1,5 @@ """Components that extract features from the input data.""" + from abc import abstractmethod import featuretools as ft diff --git a/evalml/pipelines/components/transformers/samplers/__init__.py b/evalml/pipelines/components/transformers/samplers/__init__.py index cb1862323b..d11272760f 100644 --- a/evalml/pipelines/components/transformers/samplers/__init__.py +++ b/evalml/pipelines/components/transformers/samplers/__init__.py @@ -1,3 +1,4 @@ """Sampler components.""" + from evalml.pipelines.components.transformers.samplers.undersampler import Undersampler from evalml.pipelines.components.transformers.samplers.oversampler import Oversampler diff --git a/evalml/pipelines/components/transformers/samplers/base_sampler.py b/evalml/pipelines/components/transformers/samplers/base_sampler.py index 1b54a28423..5c30df858e 100644 --- a/evalml/pipelines/components/transformers/samplers/base_sampler.py +++ b/evalml/pipelines/components/transformers/samplers/base_sampler.py @@ -1,4 +1,5 @@ """Base Sampler component. Used as the base class of all sampler components.""" + import copy from abc import abstractmethod diff --git a/evalml/pipelines/components/transformers/samplers/oversampler.py b/evalml/pipelines/components/transformers/samplers/oversampler.py index 2b22828cea..df192806ba 100644 --- a/evalml/pipelines/components/transformers/samplers/oversampler.py +++ b/evalml/pipelines/components/transformers/samplers/oversampler.py @@ -1,4 +1,5 @@ """SMOTE Oversampler component. Will automatically select whether to use SMOTE, SMOTEN, or SMOTENC based on inputs to the component.""" + from evalml.pipelines.components.transformers.samplers.base_sampler import BaseSampler from evalml.pipelines.components.utils import make_balancing_dictionary from evalml.utils import import_or_raise diff --git a/evalml/pipelines/components/transformers/samplers/undersampler.py b/evalml/pipelines/components/transformers/samplers/undersampler.py index 1b01410b9e..058413a92b 100644 --- a/evalml/pipelines/components/transformers/samplers/undersampler.py +++ b/evalml/pipelines/components/transformers/samplers/undersampler.py @@ -1,4 +1,5 @@ """An undersampling transformer to downsample the majority classes in the dataset.""" + import numpy as np import pandas as pd diff --git a/evalml/pipelines/components/transformers/scalers/__init__.py b/evalml/pipelines/components/transformers/scalers/__init__.py index 9a2c6062f2..ea6f999e7b 100644 --- a/evalml/pipelines/components/transformers/scalers/__init__.py +++ b/evalml/pipelines/components/transformers/scalers/__init__.py @@ -1,4 +1,5 @@ """Components that scale input data.""" + from evalml.pipelines.components.transformers.scalers.standard_scaler import ( StandardScaler, ) diff --git a/evalml/pipelines/components/transformers/scalers/standard_scaler.py b/evalml/pipelines/components/transformers/scalers/standard_scaler.py index e819c20b7c..d88f337d4b 100644 --- a/evalml/pipelines/components/transformers/scalers/standard_scaler.py +++ b/evalml/pipelines/components/transformers/scalers/standard_scaler.py @@ -1,4 +1,5 @@ """A transformer that standardizes input features by removing the mean and scaling to unit variance.""" + import pandas as pd from sklearn.preprocessing import StandardScaler as SkScaler diff --git a/evalml/pipelines/components/transformers/transformer.py b/evalml/pipelines/components/transformers/transformer.py index efc3548e28..877835e0b8 100644 --- a/evalml/pipelines/components/transformers/transformer.py +++ b/evalml/pipelines/components/transformers/transformer.py @@ -1,4 +1,5 @@ """A component that may or may not need fitting that transforms data. These components are used before an estimator.""" + from abc import abstractmethod from evalml.exceptions import MethodPropertyNotFoundError diff --git a/evalml/pipelines/components/utils.py b/evalml/pipelines/components/utils.py index d8c016531f..95775c1dc1 100644 --- a/evalml/pipelines/components/utils.py +++ b/evalml/pipelines/components/utils.py @@ -1,4 +1,5 @@ """Utility methods for EvalML components.""" + import inspect from typing import Dict, List, Tuple, Union diff --git a/evalml/pipelines/multiclass_classification_pipeline.py b/evalml/pipelines/multiclass_classification_pipeline.py index 80254b0a18..7b25c63066 100644 --- a/evalml/pipelines/multiclass_classification_pipeline.py +++ b/evalml/pipelines/multiclass_classification_pipeline.py @@ -1,4 +1,5 @@ """Pipeline subclass for all multiclass classification pipelines.""" + from evalml.pipelines.classification_pipeline import ClassificationPipeline from evalml.problem_types import ProblemTypes diff --git a/evalml/pipelines/multiseries_regression_pipeline.py b/evalml/pipelines/multiseries_regression_pipeline.py index df9bce6632..3031cd8b02 100644 --- a/evalml/pipelines/multiseries_regression_pipeline.py +++ b/evalml/pipelines/multiseries_regression_pipeline.py @@ -1,4 +1,5 @@ """Pipeline base class for time series regression problems.""" + import pandas as pd from woodwork.statistics_utils import infer_frequency diff --git a/evalml/pipelines/pipeline_base.py b/evalml/pipelines/pipeline_base.py index b89638afae..6be2ca1ddb 100644 --- a/evalml/pipelines/pipeline_base.py +++ b/evalml/pipelines/pipeline_base.py @@ -1,4 +1,5 @@ """Base machine learning pipeline class.""" + import copy import inspect import logging @@ -723,10 +724,12 @@ def repr_component(parameters): component_dict_str = repr(self.component_graph) parameters_repr = ", ".join( [ - f"'{component}':{{{repr_component(parameters)}}}" - if DFSTransformer.name - not in component # need to grab the component name as that is stored parameters. - else f"'{component}':{{}}" + ( + f"'{component}':{{{repr_component(parameters)}}}" + if DFSTransformer.name + not in component # need to grab the component name as that is stored parameters. + else f"'{component}':{{}}" + ) for component, parameters in self.parameters.items() ], ) diff --git a/evalml/pipelines/pipeline_meta.py b/evalml/pipelines/pipeline_meta.py index 0b5c21f8f9..7aa59213d1 100644 --- a/evalml/pipelines/pipeline_meta.py +++ b/evalml/pipelines/pipeline_meta.py @@ -1,4 +1,5 @@ """Metaclass that overrides creating a new pipeline by wrapping methods with validators and setters.""" + from functools import wraps from evalml.exceptions import PipelineNotYetFittedError diff --git a/evalml/pipelines/regression_pipeline.py b/evalml/pipelines/regression_pipeline.py index 23b3712aaf..a991ace1e4 100644 --- a/evalml/pipelines/regression_pipeline.py +++ b/evalml/pipelines/regression_pipeline.py @@ -1,4 +1,5 @@ """Pipeline subclass for all regression pipelines.""" + from evalml.pipelines import PipelineBase from evalml.problem_types import ProblemTypes from evalml.utils import infer_feature_types diff --git a/evalml/pipelines/time_series_classification_pipelines.py b/evalml/pipelines/time_series_classification_pipelines.py index b14dac3a15..517a304128 100644 --- a/evalml/pipelines/time_series_classification_pipelines.py +++ b/evalml/pipelines/time_series_classification_pipelines.py @@ -1,4 +1,5 @@ """Pipeline base class for time-series classification problems.""" + import pandas as pd from woodwork.statistics_utils import infer_frequency diff --git a/evalml/pipelines/time_series_pipeline_base.py b/evalml/pipelines/time_series_pipeline_base.py index 37f163cd90..8d98bcf486 100644 --- a/evalml/pipelines/time_series_pipeline_base.py +++ b/evalml/pipelines/time_series_pipeline_base.py @@ -1,4 +1,5 @@ """Pipeline base class for time-series problems.""" + import pandas as pd import woodwork as ww diff --git a/evalml/pipelines/time_series_regression_pipeline.py b/evalml/pipelines/time_series_regression_pipeline.py index 60a5e61cc6..9db30077c5 100644 --- a/evalml/pipelines/time_series_regression_pipeline.py +++ b/evalml/pipelines/time_series_regression_pipeline.py @@ -1,4 +1,5 @@ """Pipeline base class for time series regression problems.""" + import numpy as np import pandas as pd from woodwork.statistics_utils import infer_frequency diff --git a/evalml/pipelines/utils.py b/evalml/pipelines/utils.py index 9b73e40c31..8167c5f9f3 100644 --- a/evalml/pipelines/utils.py +++ b/evalml/pipelines/utils.py @@ -1,4 +1,5 @@ """Utility methods for EvalML pipelines.""" + import copy import os import warnings diff --git a/evalml/preprocessing/__init__.py b/evalml/preprocessing/__init__.py index a17f6ba2bb..0c05c7a609 100644 --- a/evalml/preprocessing/__init__.py +++ b/evalml/preprocessing/__init__.py @@ -1,4 +1,5 @@ """Preprocessing utilities.""" + from evalml.preprocessing.utils import ( load_data, split_data, diff --git a/evalml/preprocessing/data_splitters/__init__.py b/evalml/preprocessing/data_splitters/__init__.py index 8c165a38be..831fc2aa25 100644 --- a/evalml/preprocessing/data_splitters/__init__.py +++ b/evalml/preprocessing/data_splitters/__init__.py @@ -1,4 +1,5 @@ """Data splitter classes.""" + from evalml.preprocessing.data_splitters.no_split import NoSplit from evalml.preprocessing.data_splitters.training_validation_split import ( TrainingValidationSplit, diff --git a/evalml/preprocessing/data_splitters/no_split.py b/evalml/preprocessing/data_splitters/no_split.py index 3cdffab5df..68fa8cf992 100644 --- a/evalml/preprocessing/data_splitters/no_split.py +++ b/evalml/preprocessing/data_splitters/no_split.py @@ -1,4 +1,5 @@ """Empty Data Splitter class.""" + import numpy as np from sklearn.model_selection._split import BaseCrossValidator diff --git a/evalml/preprocessing/data_splitters/sk_splitters.py b/evalml/preprocessing/data_splitters/sk_splitters.py index d423384a11..d4ac9efd53 100644 --- a/evalml/preprocessing/data_splitters/sk_splitters.py +++ b/evalml/preprocessing/data_splitters/sk_splitters.py @@ -1,4 +1,5 @@ """SKLearn data splitter wrapper classes.""" + from sklearn.model_selection import KFold, StratifiedKFold diff --git a/evalml/preprocessing/data_splitters/time_series_split.py b/evalml/preprocessing/data_splitters/time_series_split.py index 5605d17a02..4726c684dc 100644 --- a/evalml/preprocessing/data_splitters/time_series_split.py +++ b/evalml/preprocessing/data_splitters/time_series_split.py @@ -1,4 +1,5 @@ """Rolling Origin Cross Validation for time series problems.""" + from sklearn.model_selection import TimeSeriesSplit as SkTimeSeriesSplit from sklearn.model_selection._split import BaseCrossValidator diff --git a/evalml/preprocessing/data_splitters/training_validation_split.py b/evalml/preprocessing/data_splitters/training_validation_split.py index 9c32c58ac4..f7882830ff 100644 --- a/evalml/preprocessing/data_splitters/training_validation_split.py +++ b/evalml/preprocessing/data_splitters/training_validation_split.py @@ -1,4 +1,5 @@ """Training Validation Split class.""" + import numpy as np from sklearn.model_selection import train_test_split from sklearn.model_selection._split import BaseCrossValidator diff --git a/evalml/preprocessing/utils.py b/evalml/preprocessing/utils.py index 013dc71fa9..977bad36e8 100644 --- a/evalml/preprocessing/utils.py +++ b/evalml/preprocessing/utils.py @@ -1,4 +1,5 @@ """Helpful preprocessing utilities.""" + import pandas as pd from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit diff --git a/evalml/problem_types/__init__.py b/evalml/problem_types/__init__.py index 866f326164..7d2d1b281d 100644 --- a/evalml/problem_types/__init__.py +++ b/evalml/problem_types/__init__.py @@ -1,4 +1,5 @@ """The supported types of machine learning problems.""" + from evalml.problem_types.problem_types import ProblemTypes from evalml.problem_types.utils import ( handle_problem_types, diff --git a/evalml/problem_types/problem_types.py b/evalml/problem_types/problem_types.py index 4f4b182bf0..c968499dcb 100644 --- a/evalml/problem_types/problem_types.py +++ b/evalml/problem_types/problem_types.py @@ -1,4 +1,5 @@ """Enum defining the supported types of machine learning problems.""" + from enum import Enum from evalml.utils import classproperty diff --git a/evalml/problem_types/utils.py b/evalml/problem_types/utils.py index 7f34aba059..31e8837278 100644 --- a/evalml/problem_types/utils.py +++ b/evalml/problem_types/utils.py @@ -1,4 +1,5 @@ """Utility methods for the ProblemTypes enum in EvalML.""" + import pandas as pd from pandas.api.types import is_numeric_dtype diff --git a/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py b/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py index b102dceb66..40cf2a95ed 100644 --- a/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py +++ b/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py @@ -187,9 +187,11 @@ def test_stl_fit_transform_in_sample( pd.testing.assert_series_equal( pd.Series(expected_trend), pd.Series( - stl.trends["series_1"] - if variateness == "multivariate" - else stl.trends[0], + ( + stl.trends["series_1"] + if variateness == "multivariate" + else stl.trends[0] + ), ), check_exact=False, check_index=False, diff --git a/evalml/tests/data_checks_tests/test_data_checks.py b/evalml/tests/data_checks_tests/test_data_checks.py index 02aef2dbf4..97140907d3 100644 --- a/evalml/tests/data_checks_tests/test_data_checks.py +++ b/evalml/tests/data_checks_tests/test_data_checks.py @@ -536,9 +536,9 @@ def test_default_data_checks_across_problem_types(problem_type): for check in DefaultDataChecks( problem_type, get_default_primary_search_objective(problem_type), - problem_configuration=problem_config - if is_time_series(problem_type) - else None, + problem_configuration=( + problem_config if is_time_series(problem_type) else None + ), ).data_checks ] diff --git a/evalml/tests/data_checks_tests/test_datetime_format_data_check.py b/evalml/tests/data_checks_tests/test_datetime_format_data_check.py index f75b9a6406..a6fdeb4698 100644 --- a/evalml/tests/data_checks_tests/test_datetime_format_data_check.py +++ b/evalml/tests/data_checks_tests/test_datetime_format_data_check.py @@ -21,9 +21,11 @@ def get_uneven_error(col_name, ww_payload, series=None): series_message = f"A frequency was detected in column '{col_name}' for series '{series}', but there are faulty datetime values that need to be addressed." error = DataCheckError( - message=f"A frequency was detected in column '{col_name}', but there are faulty datetime values that need to be addressed." - if series is None - else series_message, + message=( + f"A frequency was detected in column '{col_name}', but there are faulty datetime values that need to be addressed." + if series is None + else series_message + ), data_check_name=datetime_format_check_name, message_code=DataCheckMessageCode.DATETIME_HAS_UNEVEN_INTERVALS, action_options=[ diff --git a/evalml/tests/data_checks_tests/test_invalid_target_data_check.py b/evalml/tests/data_checks_tests/test_invalid_target_data_check.py index 591bc027d9..66e2d33490 100644 --- a/evalml/tests/data_checks_tests/test_invalid_target_data_check.py +++ b/evalml/tests/data_checks_tests/test_invalid_target_data_check.py @@ -754,12 +754,16 @@ def test_invalid_target_data_check_action_for_data_with_null( "impute_strategy": { "parameter_type": DCAOParameterType.GLOBAL, "type": "category", - "categories": ["mean", "most_frequent"] - if is_regression(problem_type) - else ["most_frequent"], - "default_value": "mean" - if is_regression(problem_type) - else "most_frequent", + "categories": ( + ["mean", "most_frequent"] + if is_regression(problem_type) + else ["most_frequent"] + ), + "default_value": ( + "mean" + if is_regression(problem_type) + else "most_frequent" + ), }, }, metadata={"is_target": True}, diff --git a/evalml/tests/pipeline_tests/test_pipeline_utils.py b/evalml/tests/pipeline_tests/test_pipeline_utils.py index 44641ef431..10176802fb 100644 --- a/evalml/tests/pipeline_tests/test_pipeline_utils.py +++ b/evalml/tests/pipeline_tests/test_pipeline_utils.py @@ -114,9 +114,9 @@ def test_make_pipeline( "gap": 1, "max_delay": 1, "forecast_horizon": 3, - "series_id": "series_id" - if is_multiseries(problem_type) - else None, + "series_id": ( + "series_id" if is_multiseries(problem_type) else None + ), }, } diff --git a/evalml/tests/pipeline_tests/test_time_series_pipeline.py b/evalml/tests/pipeline_tests/test_time_series_pipeline.py index e3d7ce4299..9c053bdcd5 100644 --- a/evalml/tests/pipeline_tests/test_time_series_pipeline.py +++ b/evalml/tests/pipeline_tests/test_time_series_pipeline.py @@ -867,11 +867,9 @@ def test_classification_pipeline_encodes_targets( {"negative": y, "positive": y, "neither": y}, ) y_encoded = y.map( - lambda label: "positive" - if label == 1 - else "neither" - if label == 2 - else "negative", + lambda label: ( + "positive" if label == 1 else "neither" if label == 2 else "negative" + ), ).astype("category") else: df = pd.DataFrame({"negative": y, "positive": y}) @@ -1955,9 +1953,11 @@ def test_time_series_pipeline_get_prediction_intervals( "y", ], "Regressor": [ - "Exponential Smoothing Regressor" - if ts_native_estimator - else "Linear Regressor", + ( + "Exponential Smoothing Regressor" + if ts_native_estimator + else "Linear Regressor" + ), "Drop NaN Rows Transformer.x", "Drop NaN Rows Transformer.y", ], @@ -1991,9 +1991,11 @@ def test_time_series_pipeline_get_prediction_intervals( "y", ], "Regressor": [ - "Exponential Smoothing Regressor" - if ts_native_estimator - else "Linear Regressor", + ( + "Exponential Smoothing Regressor" + if ts_native_estimator + else "Linear Regressor" + ), "Drop NaN Rows Transformer.x", "Drop NaN Rows Transformer.y", ], diff --git a/evalml/tests/utils_tests/test_gen_utils.py b/evalml/tests/utils_tests/test_gen_utils.py index 9a90ed64ba..36688e1698 100644 --- a/evalml/tests/utils_tests/test_gen_utils.py +++ b/evalml/tests/utils_tests/test_gen_utils.py @@ -162,9 +162,11 @@ def get_random_seed_wrapper(random_seed): def make_expected_values(vals, min_bound, max_bound): return np.array( [ - i - if (min_bound <= i and i < max_bound) - else ((i - min_bound) % (max_bound - min_bound)) + min_bound + ( + i + if (min_bound <= i and i < max_bound) + else ((i - min_bound) % (max_bound - min_bound)) + min_bound + ) for i in vals ], ) diff --git a/evalml/tuners/__init__.py b/evalml/tuners/__init__.py index 837d945750..1df9ce68d9 100644 --- a/evalml/tuners/__init__.py +++ b/evalml/tuners/__init__.py @@ -1,4 +1,5 @@ """EvalML tuner classes.""" + from evalml.tuners.skopt_tuner import SKOptTuner from evalml.tuners.tuner import Tuner from evalml.tuners.tuner_exceptions import NoParamsException, ParameterError diff --git a/evalml/tuners/grid_search_tuner.py b/evalml/tuners/grid_search_tuner.py index d47350608a..0724e24d8a 100644 --- a/evalml/tuners/grid_search_tuner.py +++ b/evalml/tuners/grid_search_tuner.py @@ -1,4 +1,5 @@ """Grid Search Optimizer, which generates all of the possible points to search for using a grid.""" + import itertools from skopt.space import Integer, Real diff --git a/evalml/tuners/random_search_tuner.py b/evalml/tuners/random_search_tuner.py index f231f6ee6a..60ff35dbc3 100644 --- a/evalml/tuners/random_search_tuner.py +++ b/evalml/tuners/random_search_tuner.py @@ -1,4 +1,5 @@ """Random Search Optimizer.""" + from skopt import Space from evalml.tuners import NoParamsException, Tuner diff --git a/evalml/tuners/skopt_tuner.py b/evalml/tuners/skopt_tuner.py index 9835c9ac82..d71f614d2f 100644 --- a/evalml/tuners/skopt_tuner.py +++ b/evalml/tuners/skopt_tuner.py @@ -1,4 +1,5 @@ """Bayesian Optimizer.""" + import logging import warnings diff --git a/evalml/tuners/tuner.py b/evalml/tuners/tuner.py index 26c6e0686c..0cb6c0f338 100644 --- a/evalml/tuners/tuner.py +++ b/evalml/tuners/tuner.py @@ -1,4 +1,5 @@ """Base Tuner class.""" + from abc import ABC, abstractmethod from skopt.space import Categorical, Integer, Real diff --git a/evalml/utils/__init__.py b/evalml/utils/__init__.py index 25ade51f1f..eeae52c05b 100644 --- a/evalml/utils/__init__.py +++ b/evalml/utils/__init__.py @@ -1,4 +1,5 @@ """Utility methods.""" + from evalml.utils.logger import get_logger, log_subtitle, log_title from evalml.utils.gen_utils import ( classproperty, diff --git a/evalml/utils/base_meta.py b/evalml/utils/base_meta.py index 0b780e2275..2daa6dd305 100644 --- a/evalml/utils/base_meta.py +++ b/evalml/utils/base_meta.py @@ -1,4 +1,5 @@ """Metaclass that overrides creating a new component or pipeline by wrapping methods with validators and setters.""" + from abc import ABCMeta from functools import wraps diff --git a/evalml/utils/cli_utils.py b/evalml/utils/cli_utils.py index 5b25320a10..0c5602ac5c 100644 --- a/evalml/utils/cli_utils.py +++ b/evalml/utils/cli_utils.py @@ -1,4 +1,5 @@ """CLI functions.""" + import locale import os import pathlib diff --git a/evalml/utils/gen_utils.py b/evalml/utils/gen_utils.py index af253fa021..285cf6a99c 100644 --- a/evalml/utils/gen_utils.py +++ b/evalml/utils/gen_utils.py @@ -1,4 +1,5 @@ """General utility methods.""" + import importlib import logging import os diff --git a/evalml/utils/logger.py b/evalml/utils/logger.py index a0b03cd3ef..91580c9bef 100644 --- a/evalml/utils/logger.py +++ b/evalml/utils/logger.py @@ -1,4 +1,5 @@ """Logging functions.""" + import logging import sys import time diff --git a/evalml/utils/nullable_type_utils.py b/evalml/utils/nullable_type_utils.py index 4f9d64691f..049adb74d9 100644 --- a/evalml/utils/nullable_type_utils.py +++ b/evalml/utils/nullable_type_utils.py @@ -178,8 +178,10 @@ def _get_new_logical_types_for_imputed_data( return original_schema.logical_types return { - col: _determine_fractional_type(ltype) - if isinstance(ltype, (AgeNullable, IntegerNullable)) - else ltype + col: ( + _determine_fractional_type(ltype) + if isinstance(ltype, (AgeNullable, IntegerNullable)) + else ltype + ) for col, ltype in original_schema.logical_types.items() } diff --git a/evalml/utils/update_checker.py b/evalml/utils/update_checker.py index 34cc5451a4..a876aef990 100644 --- a/evalml/utils/update_checker.py +++ b/evalml/utils/update_checker.py @@ -1,4 +1,5 @@ """Check if EvalML has updated since the user installed.""" + from pkg_resources import iter_entry_points for entry_point in iter_entry_points("alteryx_open_src_initialize"): diff --git a/evalml/utils/woodwork_utils.py b/evalml/utils/woodwork_utils.py index 1d39066a1c..dec4945240 100644 --- a/evalml/utils/woodwork_utils.py +++ b/evalml/utils/woodwork_utils.py @@ -1,4 +1,5 @@ """Woodwork utility methods.""" + import numpy as np import pandas as pd import woodwork as ww