slickml.visualization._xgboost
#
Module Contents#
Functions#
|
Visualizes the cv_results of |
|
Visualizes the XGBoost feature importance as a bar chart. |
- slickml.visualization._xgboost.plot_xgb_cv_results(cv_results: pandas.DataFrame, *, figsize: Optional[Tuple[Union[int, float], Union[int, float]]] = (8, 5), linestyle: Optional[str] = '--', train_label: Optional[str] = 'Train', test_label: Optional[str] = 'Test', train_color: Optional[str] = 'navy', train_std_color: Optional[str] = '#B3C3F3', test_color: Optional[str] = 'purple', test_std_color: Optional[str] = '#D0AAF3', save_path: Optional[str] = None, display_plot: Optional[bool] = False, return_fig: Optional[bool] = False) Optional[matplotlib.figure.Figure] [source]#
Visualizes the cv_results of
XGBoostCVClassifier
.- Parameters:
cv_results (pd.DataFrame) – Cross-validation results
figsize (Tuple[Union[int, float], Union[int, float]], optional) – Figure size, by default (8, 5)
linestyle (str, optional) – Style of lines [linestyles-api], by default “–”
train_label (str, optional) – Label in the figure legend for the train line, by default “Train”
test_label (str, optional) – Label in the figure legend for the test line, by default “Test”
train_color (str, optional) – Color of the training line, by default “navy”
train_std_color (str, optional) – Color of the edge color of the training std bars, by default “#B3C3F3”
test_color (str, optional) – Color of the testing line, by default “purple”
test_std_color (str, optional) – Color of the edge color of the testing std bars, by default “#D0AAF3”
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 False
return_fig (bool, optional) – Whether to return figure object, by default False
References
- Returns:
Figure, optional
- slickml.visualization._xgboost.plot_xgb_feature_importance(feature_importance: pandas.DataFrame, *, figsize: Optional[Tuple[Union[int, float], Union[int, float]]] = (8, 5), 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 XGBoost feature importance as a bar chart.
Notes
This plotting function can be used along with
feature_importance_
attribute of any ofXGBoostClassifier
,XGBoostCVClassifier
,XGBoostRegressor
, orXGBoostCVRegressor
classes.- Parameters:
feature importance (pd.DataFrame) – Feature importance (
feature_importance_
attribute)figsize (tuple, optional) – Figure size, by default (8, 5)
color (str, optional) – Color of the horizontal lines of lollipops, by default “#87CEEB”
marker (str, optional) – Marker style of the lollipops. More valid marker styles can be found at [markers-api], by default “o”
markersize (Union[int, float], optional) – Markersize, by default 10
markeredgecolor (str, optional) – Marker edge color, by default “#1F77B4”
markerfacecolor (str, optional) – Marker face color, by defualt “#1F77B4”
markeredgewidth (Union[int, float], optional) – Marker edge width, by default 1
fontsize (Union[int, float], optional) – Fontsize for xlabel and ylabel, and ticks parameters, by default 12
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
See also
slickml.classification.XGBoostClassifier
,slickml.classification.XGBoostCVClassifier
,slickml.regression.XGBoostRegressor
,slickml.regression.XGBoostCVRegressor
References
- Returns:
Figure, optional