<jupyter_start><jupyter_text>Import Packages<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns

from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import pickle

from keras.models import Sequential
from keras.layers import Dense, Dropout<jupyter_output><empty_output><jupyter_text>Data Loading<jupyter_code>dataset = pd.read_csv('data/Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
Y = dataset.iloc[:, 13].values

dataset<jupyter_output><empty_output><jupyter_text>Encoding<jupyter_code>Encoder_X1 = LabelEncoder()
X[:, 1] = Encoder_X1.fit_transform(X[:, 1])

Encoder_X2 = LabelEncoder()
X[:, 2] = Encoder_X2.fit_transform(X[:, 2])

X.shape<jupyter_output><empty_output><jupyter_text>Train-Test Split<jupyter_code>Train_X, Test_X, Train_Y, Test_Y = train_test_split(X, Y, test_size = 0.2, random_state = 0)<jupyter_output><empty_output><jupyter_text>Scaling<jupyter_code>sc = StandardScaler()

Train_X = sc.fit_transform(Train_X)
Test_X = sc.transform(Test_X)<jupyter_output><empty_output><jupyter_text>Model<jupyter_code>classifier = Sequential()
classifier.add(Dense(units = 32, activation = 'relu', input_dim = 10))
classifier.add(Dense(units = 16, activation = 'relu'))
classifier.add(Dense(units = 8, activation = 'relu'))
classifier.add(Dropout(0.4))
classifier.add(Dense(units = 1, activation = 'sigmoid'))

classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])<jupyter_output><empty_output><jupyter_text>Train<jupyter_code>classifier.fit(Train_X, Train_Y, batch_size = 10, epochs = 200)<jupyter_output>Epoch 1/100
800/800 [==============================] - 1s 1ms/step - loss: 0.2743 - accuracy: 0.8855
Epoch 2/100
800/800 [==============================] - 1s 1ms/step - loss: 0.2721 - accuracy: 0.8907
Epoch 3/100
800/800 [==============================] - 1s 2ms/step - loss: 0.2664 - accuracy: 0.8899
Epoch 4/100
800/800 [==============================] - 1s 2ms/step - loss: 0.2686 - accuracy: 0.8874
Epoch 5/100
800/800 [==============================] - 1s 1ms/step - loss: 0.2625 - accuracy: 0.8891
Epoch 6/100
800/800 [==============================] - 1s 1ms/step - loss: 0.2665 - accuracy: 0.8905
Epoch 7/100
800/800 [==============================] - 1s 2ms/step - loss: 0.2704 - accuracy: 0.8873
Epoch 8/100
800/800 [==============================] - 1s 2ms/step - loss: 0.2676 - accuracy: 0.8889
Epoch 9/100
800/800 [==============================] - 1s 2ms/step - loss: 0.2684 - accuracy: 0.8878
Epoch 10/100
800/800 [==============================] - 1s 1ms/step - loss: 0.2687 - accura[...]<jupyter_text>Save Model<jupyter_code>classifier.save_weights("models/model")<jupyter_output><empty_output><jupyter_text>Save Scaler<jupyter_code>with open('scalers/scaler.pickle', 'wb') as handle:
    pickle.dump(sc, handle, protocol=pickle.HIGHEST_PROTOCOL)<jupyter_output><empty_output><jupyter_text>Save Encoders<jupyter_code>with open('encoders/encoder1.pickle', 'wb') as handle:
    pickle.dump(Encoder_X1, handle, protocol=pickle.HIGHEST_PROTOCOL)
with open('encoders/encoder2.pickle', 'wb') as handle:
    pickle.dump(Encoder_X2, handle, protocol=pickle.HIGHEST_PROTOCOL)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21654135338345865, 'fraction_numerical': 0.07548872180451127, 'mean_word_length': 6.716937354988399, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '498501', 'license': 'MIT', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1211, 'n_words': 220, 'path': 'Churn_Predictor.ipynb', 'repo_name': 'Asha-Gutlapalli/BankChurnModel', 'size': '3325'}