सेगमेंटेशन के लिए डेटा तैयारी

Python में मार्केटिंग के लिए मशीन लर्निंग

Karolis Urbonas

Head of Analytics & Science, Amazon

मॉडल की धारणाएँ

  • पहले हम K-means से शुरू करेंगे
  • K-means क्लस्टरिंग तब अच्छी तरह काम करती है जब डेटा 1) लगभग नॉर्मली डिस्ट्रीब्यूटेड हो (कोई skew नहीं), और 2) स्टैंडर्डाइज़्ड हो (mean = 0, standard deviation = 1)
  • दूसरा मॉडल - NMF - कच्चे डेटा पर चल सकता है, खासकर जब मैट्रिक्स sparse हो
Python में मार्केटिंग के लिए मशीन लर्निंग

लॉग-ट्रांसफॉर्म से skew घटाएँ

# First option - log transformation
wholesale_log = np.log(wholesale)
sns.pairplot(wholesale_log, diag_kind='kde')
plt.show()
Python में मार्केटिंग के लिए मशीन लर्निंग

लॉग-ट्रांसफॉर्म डेटा देखें

पेयरप्लॉट (लॉग-ट्रांसफॉर्म)

Python में मार्केटिंग के लिए मशीन लर्निंग

Box-Cox ट्रांसफॉर्म से skew घटाएँ

# Second option - Box-Cox transformation
from scipy import stats

def boxcox_df(x):
    x_boxcox, _ = stats.boxcox(x)
    return x_boxcox

wholesale_boxcox = wholesale.apply(boxcox_df, axis=0)
sns.pairplot(wholesale_boxcox, diag_kind='kde')
plt.show()
Python में मार्केटिंग के लिए मशीन लर्निंग

Box-Cox ट्रांसफॉर्म डेटा देखें

पेयरप्लॉट (Box-Cox)

Python में मार्केटिंग के लिए मशीन लर्निंग

डेटा को स्केल करें

  • हर कॉलम मान से उसके औसत को घटाएँ
  • हर कॉलम मान को कॉलम के standard deviation से भाग दें
  • sklearn का StandardScaler() मॉड्यूल इस्तेमाल करेंगे
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()

scaler.fit(wholesale_boxcox) wholesale_scaled = scaler.transform(wholesale_boxcox) wholesale_scaled_df = pd.DataFrame(data=wholesale_scaled, index=wholesale_boxcox.index, columns=wholesale_boxcox.columns) wholesale_scaled_df.agg(['mean','std']).round()
      Fresh  Milk  Grocery  Frozen  Detergents_Paper  Delicassen
mean   -0.0   0.0      0.0     0.0              -0.0         0.0
std     1.0   1.0      1.0     1.0               1.0         1.0
Python में मार्केटिंग के लिए मशीन लर्निंग

अभ्यास करते हैं!

Python में मार्केटिंग के लिए मशीन लर्निंग

Preparing Video For Download...