pycaret.clustering.plot_model#
- pycaret.clustering.plot_model(model, plot: str = 'cluster', feature: str | None = None, label: bool = False, scale: float = 1, save: bool = False, display_format: str | None = None) str | None[source]#
This function analyzes the performance of a trained model.
Example
>>> from pycaret.datasets import get_data >>> jewellery = get_data('jewellery') >>> from pycaret.clustering import * >>> exp_name = setup(data = jewellery) >>> kmeans = create_model('kmeans') >>> plot_model(kmeans, plot = 'cluster')
- model: scikit-learn compatible object
Trained Model Object
- plot: str, default = ‘cluster’
List of available plots (ID - Name):
‘cluster’ - Cluster PCA Plot (2d)
‘tsne’ - Cluster t-SNE (3d)
‘elbow’ - Elbow Plot
‘silhouette’ - Silhouette Plot
‘distance’ - Distance Plot
‘distribution’ - Distribution Plot
- feature: str, default = None
Feature to be evaluated when plot = ‘distribution’. When
plottype is ‘cluster’ or ‘tsne’ feature column is used as a hoverover tooltip and/or label when thelabelparam is set to True. When theplottype is ‘cluster’ or ‘tsne’ and feature is None, first column of the dataset is used.- label: bool, default = False
Name of column to be used as data labels. Ignored when
plotis not ‘cluster’ or ‘tsne’.- scale: float, default = 1
The resolution scale of the figure.
- save: bool, default = False
When set to True, plot is saved in the current working directory.
- display_format: str, default = None
To display plots in Streamlit (https://www.streamlit.io/), set this to ‘streamlit’. Currently, not all plots are supported.
- Returns:
Path to saved file, if any.