Enchaînement des étapes de prétraitement

Customer Segmentation in Python

Karolis Urbonas

Head of Data Science, Amazon

Pourquoi l’ordre compte ?

  • La transformation log ne fonctionne que sur des valeurs positives
  • La normalisation impose des valeurs négatives et log ne marchera pas
Customer Segmentation in Python

Séquence

  1. Désymétriser les données : transformation log
  2. Centrer pour avoir la même moyenne
  3. Mettre à l’échelle pour la même écart-type
  4. Stocker dans un tableau séparé pour le clustering
Customer Segmentation in Python

Coder la séquence

# Unskew the data
import numpy as np
datamart_log = np.log(datamart_rfm)

# Normalize the variables from sklearn.preprocessing import StandardScaler scaler = StandardScaler() scaler.fit(datamart_log)
# Store for clustering datamart_normalized = scaler.transform(datamart_log)
Customer Segmentation in Python

Exercez-vous sur les données RFM !

Customer Segmentation in Python

Preparing Video For Download...