Skip to content

Commit

Permalink
Reformatted files with updated black version (#4395)
Browse files Browse the repository at this point in the history
* Initial commit

* Updated release notes
  • Loading branch information
christopherbunn committed Feb 13, 2024
1 parent 812a5ee commit 2c9a28f
Show file tree
Hide file tree
Showing 205 changed files with 324 additions and 82 deletions.
1 change: 1 addition & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Release Notes
-------------
**Future Releases**
* Enhancements
* Reformatted files with updated black version :pr:`4395`
* Fixes
* Changes
* Documentation Changes
Expand Down
1 change: 1 addition & 0 deletions evalml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""EvalML."""

import warnings

# hack to prevent warnings from skopt
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/automl_algorithm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""AutoML algorithms that power EvalML."""

from evalml.automl.automl_algorithm.automl_algorithm import (
AutoMLAlgorithm,
AutoMLAlgorithmException,
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/automl_algorithm/automl_algorithm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for the AutoML algorithms which power EvalML."""

import inspect
from abc import ABC, abstractmethod

Expand Down
1 change: 1 addition & 0 deletions evalml/automl/automl_algorithm/default_algorithm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/automl_algorithm/iterative_algorithm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/automl_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""EvalML's core AutoML object."""

import copy
import logging
import pickle
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Callbacks available to pass to AutoML."""

import logging

from evalml.exceptions import PipelineScoreError
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""EvalML Engine classes used to evaluate pipelines in AutoMLSearch."""

from evalml.automl.engine.engine_base import (
EngineBase,
EngineComputation,
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/engine/cf_engine.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/engine/dask_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A Future-like wrapper around jobs created by the DaskEngine."""

import joblib
from dask.distributed import Client, LocalCluster

Expand Down
1 change: 1 addition & 0 deletions evalml/automl/engine/engine_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for EvalML engines."""

import sys
import time
import traceback
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/engine/sequential_engine.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/automl/pipeline_search_plots.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Plots displayed during pipeline search."""

from evalml.utils import import_or_raise, jupyter_check


Expand Down
1 change: 1 addition & 0 deletions evalml/automl/progress.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Progress abstraction holding stopping criteria and progress information."""

import logging
import time

Expand Down
1 change: 1 addition & 0 deletions evalml/automl/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities useful in AutoML."""

from collections import namedtuple

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/class_imbalance_data_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Use for classification problems.
"""

import numpy as np
import pandas as pd

Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/data_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for all data checks."""

from abc import ABC, abstractmethod

from evalml.utils import classproperty
Expand Down
8 changes: 5 additions & 3 deletions evalml/data_checks/data_check_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
)
1 change: 1 addition & 0 deletions evalml/data_checks/data_check_action_code.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enum for data check action code."""

from enum import Enum

from evalml.utils import classproperty
Expand Down
15 changes: 9 additions & 6 deletions evalml/data_checks/data_check_action_option.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Recommended action returned by a DataCheck."""

from enum import Enum

from evalml.data_checks.data_check_action import DataCheckAction
Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/data_check_message.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Messages returned by a DataCheck, tagged by name."""

from evalml.data_checks.data_check_message_type import DataCheckMessageType


Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/data_check_message_code.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enum for data check message code."""

from enum import Enum


Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/data_check_message_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enum for type of data check message."""

from enum import Enum


Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/data_checks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A collection of data checks."""

import inspect

from evalml.data_checks import DataCheck
Expand Down
49 changes: 31 additions & 18 deletions evalml/data_checks/datetime_format_data_check.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand All @@ -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(),
Expand All @@ -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(),
Expand All @@ -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(),
Expand All @@ -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=[
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/default_data_checks.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 11 additions & 6 deletions evalml/data_checks/invalid_target_data_check.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/multicollinearity_data_check.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/no_variance_data_check.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/null_data_check.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/outliers_data_check.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/sparsity_data_check.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/target_distribution_data_check.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/target_leakage_data_check.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/ts_parameters_data_check.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/ts_splitting_data_check.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/uniqueness_data_check.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions evalml/data_checks/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility methods for the data checks in EvalML."""

from evalml.data_checks.data_check_action_code import DataCheckActionCode


Expand Down
1 change: 1 addition & 0 deletions evalml/demos/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit 2c9a28f

Please sign in to comment.