paramonte._CorCovMat

Module Contents

Classes

CorCovMat(dataFrame, columns=None, methodName='ParaMonte', reportEnabled=True)

CorMat(dataFrame, columns=None, methodName='ParaMonte', reportEnabled=True, method='pearson')

This is the class for generating object of type CorMat which,

CovMat(dataFrame, columns=None, methodName='ParaMonte', reportEnabled=True)

This is the class for generating object of type CovMat which,

Functions

getCorFromCov(covMat)

paramonte._CorCovMat.Struct[source]
paramonte._CorCovMat.newline
paramonte._CorCovMat.getCorFromCov(covMat)[source]
class paramonte._CorCovMat.CorCovMat(dataFrame, columns=None, methodName='ParaMonte', reportEnabled=True)[source]
__call__(self, reself: tp.Optional[bool] = False, **kwargs)[source]

Call the get() method of the current instance of the class.

Parameters

reself

A logical variable. If True, an instance of the object will be returned upon exit to the calling routine. The default value is False.

Also, any attributes of the current instance of the class.

Returns

The object self if reself = True otherwise, None. However, this method causes side-effects by manipulating the existing attributes of the object.

get(self, reself: tp.Optional[bool] = False, **kwargs)[source]

Compute the correlation / covariance matrix of the selected columns of the input dataframe to the object’s constructor.

Parameters

reself

A logical variable. If True, an instance of the object will be returned to the calling routine upon exit. The default value is False.

Returns

The object self if reself = True otherwise, None.

NOTE

This method causes side-effects by manipulating the existing attributes of the object.

_resetPlot(self, resetType='soft', plotNames='all')[source]

Reset the properties of the plot to the original default settings. Use this method when you change many attributes of the plot and you want to clean up and go back to the default settings.

Parameters

resetType (optional)

An optional string with possible value of "hard". If provided, the plot object will be regenerated from scratch. This includes reading the original data frame again and resetting everything. If not provided, then only the plot settings will be reset without reseting the dataFrame.

plotNames (optional)

An optional string value or list of string values representing the names of plots to reset. If no value is provided, then all plots will be reset.

Returns

None

Example

reset("hard")                    # regenerate all plots from scratch
reset("hard","heatmap")          # regenerate heatmap plot from scratch
_reportWrongPlotName(self, plotNames)[source]
class paramonte._CorCovMat.CorMat(dataFrame, columns=None, methodName='ParaMonte', reportEnabled=True, method='pearson')[source]

Bases: paramonte._CorCovMat.CorCovMat

This is the class for generating object of type CorMat which, upon construction, will provide methods to compute and plot the correlation matrix of the selected columns of the input dataFrame.

Parameters

dataFrame

A Pandas dataFrame based upon the selected columns of which the correlation matrix will be computed.

columns (optional)

optional argument that determines the columns of the input dataFrame to be used in the computation of the correlation matrix. It can have three forms:

  1. A list of column indices from the input dataFrame.

  2. A list of column names from dataFrame.columns.

  3. A range(start,stop,step) of column indices.

Examples:

  1. columns = [0,1,4,3]

  2. columns = ["SampleLogFunc","SampleVariable1"]

  3. columns = range(17,7,-2)

The default behavior includes all columns of the dataFrame.

method (optional)

A string value representing the method to be used for the computation of correlations:

  1. 'pearson' : standard correlation coefficient,

  2. 'kendall' : Kendall Tau correlation coefficient,

  3. 'spearman' : Spearman rank correlation.

The default value is 'pearson'.

Attributes

All of the parameters described above, except dataFrame.

A reference to the dataFrame will be implicitly stored in the object.

df

A pandas dataframe containing the computed correlation matrix.

rows

A list that determines the rows of the input dataFrame to be used in the computation of the correlation matrix. It can be either:

  1. A range(start,stop,step), or,

  2. A list of row indices from dataFrame.index.

Examples:

  1. rows = range(17,7,-2)

  2. rows = [i for i in range(7,17)]

The default behavior includes all rows of the dataFrame.

plot

A structure containing the following plotting tools:

heatmap

A callable object of class HeatMap which will enable plotting of the correlation matrix.

Returns

self

An object of type class CorMat.

class paramonte._CorCovMat.CovMat(dataFrame, columns=None, methodName='ParaMonte', reportEnabled=True)[source]

Bases: paramonte._CorCovMat.CorCovMat

This is the class for generating object of type CovMat which, upon construction, will provide methods to compute and plot the covariance matrix of the selected columns of the input dataFrame.

Parameters

dataFrame

A Pandas dataframe based upon the selected columns of which the covariance matrix will be computed.

columns (optional)

A argument that determines the columns of the input dataFrame to be used in the computation of the covariance matrix. It can have three forms:

  1. A list of column indices from the input dataFrame.

  2. A list of column names from dataFrame.columns.

  3. A range(start,stop,step) of column indices.

Examples:

  1. columns = [0,1,4,3]

  2. columns = ["SampleLogFunc","SampleVariable1"]

  3. columns = range(17,7,-2)

The default behavior includes all columns of the dataFrame.

Attributes

All of the parameters described above, except dataFrame.

A reference to the dataFrame will be implicitly stored in the object.

df

A pandas dataframe containing the computed covariance matrix.

rows

A list that determines the rows of the input dataFrame to be used in the computation of the covariance matrix. It can be either:

  1. A range(start,stop,step), or,

  2. A list of row indices from dataFrame.index.

Examples:

  1. rows = range(17,7,-2)

  2. rows = [i for i in range(7,17)]

The default behavior includes all rows of the dataFrame.

plot

A structure containing the following plotting tools:

heatmap

A callable object of class HeatMap which will enable plotting of the correlation matrix.

Returns

self

An object of type class CovMat.