Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

highly correlated features python

# 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)]

df.drop(to_drop, axis=1, inplace=True)
Comment

highly correlated features python

# 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)]
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter file dialog multiple file types 
Python :: phone no validate 
Python :: How printe word in python 
Python :: voilion plot 
Python :: python print string in red color 
Python :: print a commans in python 
Python :: django reverse accessor clashes for abstract class 
Python :: arrays with name instead of index python 
Python :: python generator in while loop 
Python :: java to python code conversion 
Python :: python multilevel list comprehension 
Python :: While importing we detected an older version of numpy in 
Python :: seaborn heatmap spearman correlation coefficient 
Python :: silent plt.plot 
Python :: sleep python 
Python :: pyplot common labels 
Python :: sending whatsapp message from python notebook 
Python :: pandas iat 0 
Python :: if ele in python 
Python :: manipulation 
Python :: How to run python in command promt 
Python :: matplotlib add abline 
Python :: Count the number of Missing Values in the DataFrame 
Python :: how to get each word in a string 
Python :: for loop for multiple things 
Python :: python keyword search engine 
Python :: how to strip characters in python 
Python :: pyhton transpose without changing column and row names 
Python :: csv python 
Python :: change y axis scale python 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =