mlens.visualization.var_analysis module¶
ML-ENSEMBLE
author: | Sebastian Flennerhag |
---|---|
copyright: | 2017 |
licence: | MIT |
Explained variance plots.
-
mlens.visualization.var_analysis.
exp_var_plot
(X, estimator, figsize=(10, 8), buffer=0.01, set_labels=True, title='Explained variance ratio', title_font_size=14, show=True, ax=None, **kwargs)[source]¶ Function to plot the explained variance using PCA.
Parameters: - X (array-like of shape = [n_samples, n_features]) – input matrix to be used for prediction.
- estimator (class) – PCA estimator, not initiated, assumes a Scikit-learn API.
- figsize (tuple (default = (10, 8))) – Size of figure.
- buffer (float (default = 0.01)) – For creating a buffer around the edges of the graph. The buffer
added is calculated as
num_components
*buffer
, wherenum_components
determine the length of the x-axis. - set_labels (bool) – whether to set axis labels.
- title (str) – figure title if shown.
- title_font_size (int) – title font size.
- show (bool (default = True)) – whether to print figure using
matplotlib.pyplot.show
. - ax (object, optional) – axis to attach plot to.
- **kwargs (optional) – optional arguments passed to the
matplotlib.pyplot.step
function.
Returns: ax – if
ax
was specified, returnsax
with plot attached.Return type: optional
-
mlens.visualization.var_analysis.
pca_comp_plot
(X, y=None, figsize=(10, 8), title='Principal Components Comparison', title_font_size=14, show=True, **kwargs)[source]¶ Function for comparing PCA analysis.
Function compares across 2 and 3 dimensions and linear and rbf kernels.
Parameters: - X (array-like of shape = [n_samples, n_features]) – input matrix to be used for prediction.
- y (array-like of shape = [n_samples, ] or None (default = None)) – training labels to be used for color highlighting.
- figsize (tuple (default = (10, 8))) – Size of figure.
- title (str) – figure title if shown.
- title_font_size (int) – title font size.
- show (bool (default = True)) – whether to print figure
matplotlib.pyplot.show
. - **kwargs (optional) – optional arguments to pass to
mlens.visualization.pca_plot
.
Returns: axis object.
Return type: ax
See also
-
mlens.visualization.var_analysis.
pca_plot
(X, estimator, y=None, cmap=None, figsize=(10, 8), title='Principal Components Analysis', title_font_size=14, show=True, ax=None, **kwargs)[source]¶ Function to plot a PCA analysis of 1, 2, or 3 dims.
Parameters: - X (array-like of shape = [n_samples, n_features]) – matrix to perform PCA analysis on.
- estimator (instance) – PCA estimator. Assumes a Scikit-learn API.
- y (array-like of shape = [n_samples, ] or None (default = None)) – training labels to be used for color highlighting.
- cmap (object, optional) – cmap object to pass to
matplotlib.pyplot.scatter
. - figsize (tuple (default = (10, 8))) – Size of figure.
- title (str) – figure title if shown.
- title_font_size (int) – title font size.
- show (bool (default = True)) – whether to print figure
matplotlib.pyplot.show
. - ax (object, optional) – axis to attach plot to.
- **kwargs (optional) – arguments to pass to
matplotlib.pyplot.scatter
.
Returns: ax – if
ax
was specified, returnsax
with plot attached.Return type: optional