Skip to content

Commit

Permalink
fix flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarvid committed Mar 14, 2024
1 parent 4819fad commit 548dac4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion pipeline_lib/core/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
from .predict import PredictStep # noqa: F401
from .tabular_split import TabularSplitStep # noqa: F401
from .target_scaling import TargetScalingStep # noqa: F401
from .explainer_dashboard import ExplainerDashboardStep # noqa: F401
12 changes: 10 additions & 2 deletions pipeline_lib/core/steps/explainer_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pandas as pd
from explainerdashboard import RegressionExplainer

from pipeline_lib.core import DataContainer
Expand All @@ -7,6 +6,7 @@

class ExplainerDashboardStep(PipelineStep):
"""Scale the target using Quantile Transformer."""

def __init__(
self,
max_samples: int = 1000,
Expand All @@ -29,6 +29,10 @@ def execute(self, data: DataContainer) -> DataContainer:

if len(df) > self.max_samples:
# Randomly sample a subset of data points if the dataset is larger than max_samples
self.logger.info(
f"Dataset contains {len(df)} data points and max_samples is set to"
f" {self.max_samples}."
)
self.logger.info(f"Sampling {self.max_samples} data points from the dataset.")
df = df.sample(n=self.max_samples, random_state=42)

Expand All @@ -39,7 +43,11 @@ def execute(self, data: DataContainer) -> DataContainer:
X_test = df.drop(columns=[target])
y_test = df[target]

explainer = RegressionExplainer(model, X_test, y_test,)
explainer = RegressionExplainer(
model,
X_test,
y_test,
)

data[DataContainer.EXPLAINER] = explainer

Expand Down

0 comments on commit 548dac4

Please sign in to comment.