Skip to content

Commit

Permalink
Black ...
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhessam88 committed May 16, 2021
1 parent 70b5b34 commit 4cf63cc
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 71 deletions.
32 changes: 16 additions & 16 deletions slickml/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def plot_feature_importance(
markerfacecolor=None,
markeredgewidth=None,
fontsize=None,
save_path=None
save_path=None,
):

"""Function to plot XGBoost feature importance.
Expand Down Expand Up @@ -348,10 +348,10 @@ def plot_feature_importance(
fontsize: int or float, optional, (default=12)
Fontsize for xlabel and ylabel, and ticks parameters
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
"""

plot_xgb_feature_importance(
Expand All @@ -364,7 +364,7 @@ def plot_feature_importance(
markerfacecolor=markerfacecolor,
markeredgewidth=markeredgewidth,
fontsize=fontsize,
save_path=save_path
save_path=save_path,
)

def plot_shap_summary(
Expand All @@ -383,7 +383,7 @@ def plot_shap_summary(
class_names=None,
class_inds=None,
color_bar_label=None,
save_path=None
save_path=None,
):
"""Function to plot shap summary plot.
This function is a helper function to plot the shap summary plot
Expand Down Expand Up @@ -440,10 +440,10 @@ def plot_shap_summary(
color_bar_label: str, optional, (default="Feature Value")
Label for color bar
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
"""

# define tree explainer
Expand Down Expand Up @@ -477,7 +477,7 @@ def plot_shap_summary(
class_names=class_names,
class_inds=class_inds,
color_bar_label=color_bar_label,
save_path=save_path
save_path=save_path,
)

def plot_shap_waterfall(
Expand All @@ -495,7 +495,7 @@ def plot_shap_waterfall(
max_display=None,
title=None,
fontsize=None,
save_path=None
save_path=None,
):
"""Function to plot shap waterfall plot.
This function is a helper function to plot the shap waterfall plot
Expand Down Expand Up @@ -549,10 +549,10 @@ def plot_shap_waterfall(
fontsize: int or float, optional, (default=12)
Fontsize for xlabel and ylabel, and ticks parameters
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
"""

# define tree explainer
Expand Down Expand Up @@ -585,7 +585,7 @@ def plot_shap_waterfall(
max_display=max_display,
title=title,
fontsize=fontsize,
save_path=save_path
save_path=save_path,
)

def _dtrain(self, X_train, y_train):
Expand Down Expand Up @@ -1044,7 +1044,7 @@ def plot_cv_results(
train_std_color=None,
test_color=None,
test_std_color=None,
save_path=None
save_path=None,
):
"""
Function to plot the results of xgboost.cv() process and evolution
Expand Down Expand Up @@ -1079,10 +1079,10 @@ def plot_cv_results(
test_std_color: str, optional, (default="#D0AAF3")
Color of the edge color of the testing std bars
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
"""

plot_xgb_cv_results(
Expand All @@ -1095,7 +1095,7 @@ def plot_cv_results(
train_std_color=train_std_color,
test_color=test_color,
test_std_color=test_std_color,
save_path=save_path
save_path=save_path,
)

def _cv(self):
Expand Down
23 changes: 15 additions & 8 deletions slickml/feature_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def plot_frequency(
markerfacecolor=None,
markeredgewidth=None,
fontsize=None,
save_path=None
save_path=None,
):

"""Function to plot selected features frequency.
Expand Down Expand Up @@ -625,11 +625,17 @@ def plot_frequency(
markerfacecolor=markerfacecolor,
markeredgewidth=markeredgewidth,
fontsize=fontsize,
save_path=save_path
save_path=save_path,
)

def plot_cv_results(
self, figsize=None, int_color=None, ext_color=None, sharex=False, sharey=False, save_path=None
self,
figsize=None,
int_color=None,
ext_color=None,
sharex=False,
sharey=False,
save_path=None,
):
"""Function to plot the cross-validation results of
XGBoostFeatureSelector. It visualizes the internal
Expand All @@ -656,10 +662,10 @@ def plot_cv_results(
sharey: bool, optional, (default=False)
Flag to share "Y" axis for each row of subplots
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
kwargs: dict
Plotting object plotting_cv_
Expand All @@ -668,10 +674,11 @@ def plot_cv_results(
plot_xfs_cv_results(
figsize=figsize,
int_color=int_color,
ext_color=ext_color,
sharex=sharex, sharey=sharey,
ext_color=ext_color,
sharex=sharex,
sharey=sharey,
save_path=save_path,
**self.plotting_cv_
**self.plotting_cv_,
)

def get_xgb_params(self):
Expand Down
18 changes: 10 additions & 8 deletions slickml/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,15 @@ def plot(self, figsize=None, save_path=None):
----------
figsize: tuple, optional, (default=(12, 12))
Figure size
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
"""

plot_binary_classification_metrics(figsize=figsize,
save_path=save_path,
**self.plotting_dict_)
plot_binary_classification_metrics(
figsize=figsize, save_path=save_path, **self.plotting_dict_
)


class RegressionMetrics:
Expand Down Expand Up @@ -910,10 +910,12 @@ def plot(self, figsize=None, save_path=None):
----------
figsize: tuple, optional, (default=(12, 12))
Figure size
save_path: str, optional (default=None)
The full or relative path to save the plot including the image format.
For example "myplot.png" or "../../myplot.pdf"
For example "myplot.png" or "../../myplot.pdf"
"""

plot_regression_metrics(figsize=figsize, save_path=save_path, **self.plotting_dict_)
plot_regression_metrics(
figsize=figsize, save_path=save_path, **self.plotting_dict_
)
Loading

0 comments on commit 4cf63cc

Please sign in to comment.