Answers for "scikit learn to identify highly correlated features"

0

scikit learn to identify highly correlated features

# Create correlation matrix
corr_matrix = df.corr().abs()

# Select upper triangle of correlation matrix
upper = corr_matrix.where(np.triu(np.ones(corr_matrix.shape), k=1).astype(np.bool))

# Find index of feature columns with correlation greater than 0.95
to_drop = [column for column in upper.columns if any(upper[column] > 0.95)]
Posted by: Guest on November-02-2020
0

how to print correlation to a feature in pyhton

df[df.columns[1:]].corr()['LoanAmount'][:]
Posted by: Guest on February-26-2020

Python Answers by Framework

Browse Popular Code Answers by Language