<jupyter_start><jupyter_text>IMPORTS<jupyter_code>import pandas as pd
import numpy as np 
import os 
import matplotlib.pylab as plt
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import classification_report
import sklearn.metrics<jupyter_output><empty_output><jupyter_text>READ THE DATA<jupyter_code>train = pd.read_csv('./input/train.csv')
train.dtypes<jupyter_output><empty_output><jupyter_text>EDA BLOCK<jupyter_code>print(train.describe())
print(train.info())
train.head()
import seaborn as sns
corr = train.corr()
plt.figure(figsize=(16,14))
sns.heatmap(corr, vmax=0.5, center=0, square=True, linewidths=2, cmap='Blues')
plt.show()
train.corr()['ordered']<jupyter_output><empty_output><jupyter_text>MODELING<jupyter_code>predictors = train.drop(['ordered', 'UserID', 'device_mobile'], axis=1)
targets = train.ordered
print(predictors.columns)
X_train, X_test, y_train, y_test = train_test_split(predictors, targets, test_size=.3)
print('Predictor-Training: ', X_train.shape, '\n','Predictor-Testing: ', X_test.shape)
from sklearn.naive_bayes import GaussianNB

classifier = GaussianNB()
classifier = classifier.fit(X_train, y_train)

predictions = classifier.predict(X_test)

sklearn.metrics.confusion_matrix(y_test, predictions)
sklearn.metrics.accuracy_score(y_test, predictions)
yesterday_prospects = pd.read_csv('./input/test.csv')

print(yesterday_prospects.info())
userids = yesterday_prospects.UserID

yesterday_prospects = yesterday_prospects.drop(['ordered', 'UserID', 'device_mobile'], axis=1)
print(yesterday_prospects.head(10))
yesterday_prospects.shape
yesterday_prospects['propensity'] = classifier.predict_proba(yesterday_prospects)[:,1]

print(yesterday_prospects.head())<jupyter_output>basket_icon_click  basket_add_list  basket_add_detail  sort_by  \
0                  0                0                  0        0   
1                  0                0                  0        0   
2                  0                0                  0        0   
3                  0                0                  1        0   
4                  0                0                  0        0   

   image_picker  account_page_click  promo_banner_click  detail_wishlist_add  \
0             0                   0                   0                    0   
1             0                   0                   0                    0   
2             0                   0                   0                    0   
3             0                   0                   0                    0   
4             0                   0                   0                    0   

   list_size_dropdown  closed_minibasket_click  ...  saw_checkout  \
0                   0              [...]<jupyter_text>SAVE THE RESULTS<jupyter_code>pd.DataFrame(userids)
results = pd.concat([userids, yesterday_prospects], axis=1)
results.head()
results.to_csv('results.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08941728064300067, 'fraction_numerical': 0.022438044206296047, 'mean_word_length': 2.131027253668763, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '393658', 'license': 'MIT', 'n_tokens_mistral': 961, 'n_tokens_neox': 913, 'n_words': 169, 'path': 'Customer_Propensity/main.ipynb', 'repo_name': 'Andy666Fox/TINY_DS_PROJECTS', 'size': '2986'}