numeric_edahelper.get_correlated_features

Module Contents

Functions

get_correlated_features(X, threshold, consider_sign=False)

Calculates correlation between all feature pairs in the input data.

numeric_edahelper.get_correlated_features.get_correlated_features(X, threshold, consider_sign=False)[source]

Calculates correlation between all feature pairs in the input data. Returns feature pairs having correlation higher than the threshold value.

Parameters
  • X (pandas.DataFrame) – numeric feature set used for EDA analysis

  • threshold (float) – threshold for correlation above which feature pairs will be returned

  • consider_sign (boolean (optional)) – determines whether correlation value has to be checked for magnitude only or for sign (positive/ negative) also. Default checks only the magnitude.

Returns

dataframe containing feature1, feature2, and corresponding correlation.

Return type

pandas.DataFrame

Examples

>>> import pandas as pd
>>> X = pd.DataFrame({"age": [23, 13, 7, 45],
                      "height": [1.65, 1.23, 0.96, 1.55],
                      "income": [20, 120, 120, 25]})
>>> get_correlated_features(X, threshold=0.7)