Rimozione degli outlier

Feature Engineering per il Machine Learning in Python

Robert O'Callaghan

Director of Data Science, Ordergroove

Cosa sono gli outlier?

Immagine della distribuzione

Feature Engineering per il Machine Learning in Python

Rilevamento basato sui quantili

Feature Engineering per il Machine Learning in Python

Quantili in Python

q_cutoff = df['col_name'].quantile(0.95)

mask = df['col_name'] < q_cutoff

trimmed_df = df[mask]
Feature Engineering per il Machine Learning in Python

Rilevamento basato sulla deviazione standard

Feature Engineering per il Machine Learning in Python

Deviazione standard in Python

mean = df['col_name'].mean()
std = df['col_name'].std()

cut_off = std * 3 lower, upper = mean - cut_off, mean + cut_off
new_df = df[(df['col_name'] < upper) & (df['col_name'] > lower)]
Feature Engineering per il Machine Learning in Python

Esercitiamoci!

Feature Engineering per il Machine Learning in Python

Preparing Video For Download...