Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create correlation matrix
- corr_matrix = X_f1.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)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement