Skip to content

Commit

Permalink
add types
Browse files Browse the repository at this point in the history
  • Loading branch information
auguste-probabl committed Feb 20, 2025
1 parent 56417be commit ac49914
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
Expand All @@ -14,11 +16,11 @@ class _FeatureImportanceAccessor(_BaseAccessor, DirNamesMixin):
You can access this accessor using the `feature_importance` attribute.
"""

def __init__(self, parent):
def __init__(self, parent: Any) -> None:
super().__init__(parent)

@available_if(_check_is_regressor_coef_task)
def model_weights(self):
def model_weights(self) -> pd.DataFrame:
"""Report the coefficients of a regression estimator.
Only works for LinearRegression, Ridge, and Lasso scikit-learn estimators.
Expand Down Expand Up @@ -87,13 +89,13 @@ def model_weights(self):
# Methods related to the help tree
####################################################################################

def _get_help_panel_title(self):
def _get_help_panel_title(self) -> str:
return "[bold cyan]Available feature importance methods[/bold cyan]"

def _get_help_tree_title(self):
def _get_help_tree_title(self) -> str:
return "[bold cyan]report.feature_importance[/bold cyan]"

def __repr__(self):
def __repr__(self) -> str:
"""Return a string representation using rich."""
return self._rich_repr(
class_name="skore.EstimatorReport.feature_importance",
Expand Down

0 comments on commit ac49914

Please sign in to comment.