mlens.visualization.correlations module¶
ML-ENSEMBLE
author: | Sebastian Flennerhag |
---|---|
copyright: | 2017 |
licence: | MIT |
Correlation plots.
-
mlens.visualization.correlations.
clustered_corrmap
(corr, cls, label_attr_name='labels_', figsize=(10, 8), annotate=False, inflate=False, linewidths=0.5, cbar_kws='default', show=True, title_fontsize=14, title_name='Clustered correlation heatmap', ax=None, **kwargs)[source]¶ Function for plotting a clustered correlation heatmap.
Parameters: - corr (array-like of shape = [n_features, n_features]) – Input correlation matrix. Pass a pandas
DataFrame
for axis labels. - cls (instance) – cluster estimator with a
fit
method and cluster labels stored as an attribute as specified by thelabel_attr_name
parameter. - label_attr_name (str) – name of attribute that contains cluster labels.
- figsize (tuple (default = (10, 8))) – Size of figure.
- annotate (bool (default = True)) – Whether to print the correlation coefficients.
- inflate (bool (default = True)) – Whether to inflate correlation coefficients to a 0-100 scale. Avoids decimal points in the figure, which often appears very cluttered otherwise.
- linewidths (float (default = .5)) – with of line separating each coordinate square.
- cbar_kws (dict, str (default = 'default')) – Optional arguments to color bar.
- title_name (str) – Figure title.
- title_fontsize (int) – size of title.
- show (bool (default = True)) – whether to print figure using
matplotlib.pyplot.show
. - ax (object, optional) – axis to attach plot to.
- **kwargs (optional) – Other optional arguments to sns heatmap.
See also
- corr (array-like of shape = [n_features, n_features]) – Input correlation matrix. Pass a pandas
-
mlens.visualization.correlations.
corr_X_y
(X, y, top=5, figsize=(10, 8), fontsize=12, hspace=None, no_ticks=True, label_rotation=0, show=True)[source]¶ Function for plotting input feature correlations with output.
Output figure shows all correlations as well as top pos and neg.
Parameters: - X (pandas DataFrame of shape = [n_samples, n_features]) – Input data.
- y (pandas Series of shape = [n_samples,]) – training labels.
- top (int) – number of features to show in top pos and neg graphs.
- figsize (tuple (default = (10, 8))) – Size of figure.
- hspace (float, optional) – whitespace between top row of figures and bottom figure.
- fontsize (int) – font size of subplot titles.
- no_ticks (bool (default = False)) – whether to remove ticklabels from full correlation plot.
- label_rotation (float (default = 0)) – rotation of labels
- show (bool (default = True)) – whether to print figure using
matplotlib.pyplot.show
.
Returns: ax – axis object.
Return type: object
-
mlens.visualization.correlations.
corrmat
(corr, figsize=(11, 9), annotate=True, inflate=True, linewidths=0.5, cbar_kws='default', show=True, ax=None, title='Correlation Matrix', title_font_size=14, **kwargs)[source]¶ Function for generating color-coded correlation triangle.
Parameters: - corr (array-like of shape = [n_features, n_features]) – Input correlation matrix. Pass a pandas
DataFrame
for axis labels. - figsize (tuple (default = (11, 9))) – Size of printed figure.
- annotate (bool (default = True)) – Whether to print the correlation coefficients.
- inflate (bool (default = True)) – Whether to inflate correlation coefficients to a 0-100 scale. Avoids decimal points in the figure, which often appears very cluttered otherwise.
- linewidths (float) – with of line separating each coordinate square.
- cbar_kws (dict, str (default = 'default')) – Optional arguments to color bar. The default options, ‘default’,
passes the
shrink
parameter to fit colorbar standard figure frame. - show (bool (default = True)) – whether to print figure using
matplotlib.pyplot.show
. - title (str) – figure title if shown.
- title_font_size (int) – title font size.
- ax (object, optional) – axis to attach plot to.
- **kwargs (optional) – Other optional arguments to sns heatmap.
Returns: ax – axis object.
Return type: object
- corr (array-like of shape = [n_features, n_features]) – Input correlation matrix. Pass a pandas