Dimensionality Reduction in Python
Jeroen Boeye
Head of Machine Learning, Faktion
# Create positive correlation matrix corr_df = chest_df.corr().abs()
# Create and apply mask mask = np.triu(np.ones_like(corr_df, dtype=bool))
tri_df = corr_df.mask(mask) tri_df
# Find columns that meet threshold
to_drop = [c for c in tri_df.columns if any(tri_df[c] > 0.95)]
print(to_drop)
['Suprasternale height', 'Cervicale height']
# Drop those columns
reduced_df = chest_df.drop(to_drop, axis=1)
sns.scatterplot(x="N firetrucks sent to fire",
y="N wounded by fire",data=fire_df)
Dimensionality Reduction in Python