slickml.visualization._selection
#
Module Contents#
Functions#
|
Visualizies the cross-validation results of |
|
Visualizes the selected features frequency as a bar chart. |
- slickml.visualization._selection.plot_xfs_cv_results(*, figsize: Optional[Tuple[Union[int, float], Union[int, float]]] = (10, 8), internalcvcolor: Optional[str] = '#4169E1', externalcvcolor: Optional[str] = '#8A2BE2', sharex: Optional[bool] = False, sharey: Optional[bool] = False, save_path: Optional[str] = None, display_plot: Optional[bool] = True, return_fig: Optional[bool] = False, **kwargs: Dict[str, Any]) Optional[matplotlib.figure.Figure] [source]#
Visualizies the cross-validation results of
XGBoostFeatureSelector
.Notes
It visualizes the internal and external cross-validiation performance during the selection process. The internal refers to the performance of the train/test folds during the
xgboost.cv()
usingmetrics
rounds to help the best number of boosting round while the external refers to the performance ofxgboost.train()
based on watchlist usingeval_metric
. Additionally, sns.distplot previously was used which is now deprecated. More details in [seaborn-distplot-deprecation].- Parameters:
figsize (tuple, optional) – Figure size, by default (10, 8)
internalcvcolor (str, optional) – Color of the histograms for internal cv results, by default “#4169E1”
externalcvcolor (str, optional) – Color of the histograms for external cv results, by default “#8A2BE2”
sharex (bool, optional) – Whether to share “X” axis for each column of subplots, by default False
sharey (bool, optional) – Whether to share “Y” axis for each row of subplots, by default False
save_path (str, optional) – The full or relative path to save the plot including the image format such as “myplot.png” or “../../myplot.pdf”, by default None
display_plot (bool, optional) – Whether to show the plot, by default True
return_fig (bool, optional) – Whether to return figure object, by default False
kwargs (Dict[str, Any]) – Required plooting elements (
plotting_cv_
attribute ofXGBoostFeatureSelector
)
See also
slickml.selection.XGBoostFeatureSelector
,Refereces
,---------
,- Returns:
Figure, optional
- slickml.visualization._selection.plot_xfs_feature_frequency(freq: pandas.DataFrame, *, figsize: Optional[Tuple[Union[int, float], Union[int, float]]] = (8, 4), show_freq_pct: Optional[bool] = True, color: Optional[str] = '#87CEEB', marker: Optional[str] = 'o', markersize: Optional[Union[int, float]] = 10, markeredgecolor: Optional[str] = '#1F77B4', markerfacecolor: Optional[str] = '#1F77B4', markeredgewidth: Optional[Union[int, float]] = 1, fontsize: Optional[Union[int, float]] = 12, save_path: Optional[str] = None, display_plot: Optional[bool] = True, return_fig: Optional[bool] = False) Optional[matplotlib.figure.Figure] [source]#
Visualizes the selected features frequency as a bar chart.
This plotting function can be used along with
feature_frequency_
attribute of any frequency-based feature selection algorithm such asXGBoostFeatureSelector
.- feature importancepd.DataFrame
Feature importance (
feature_frequency_
attribute)- figsizetuple, optional
Figure size, by default (8, 4)
- show_freq_pctbool, optional
Whether to show the features frequency in percent, by default True
- colorstr, optional
Color of the horizontal lines of lollipops, by default “#87CEEB”
- markerstr, optional
Marker style of the lollipops. More valid marker styles can be found at [markers-api], by default “o”
- markersizeUnion[int, float], optional
Markersize, by default 10
- markeredgecolorstr, optional
Marker edge color, by default “#1F77B4”
- markerfacecolorstr, optional
Marker face color, by defualt “#1F77B4”
- markeredgewidthUnion[int, float], optional
Marker edge width, by default 1
- fontsizeUnion[int, float], optional
Fontsize for xlabel and ylabel, and ticks parameters, by default 12
- save_pathstr, optional
The full or relative path to save the plot including the image format such as “myplot.png” or “../../myplot.pdf”, by default None
- display_plotbool, optional
Whether to show the plot, by default True
- return_figbool, optional
Whether to return figure object, by default False
References
- Returns:
Figure, optional