<jupyter_start><jupyter_text>Creating different Xtrain and ytrain using SMOTE to address the class imbalance problem**<jupyter_code>smote=SMOTETomek(random_state=42)
X_train1,y_train1= smote.fit_resample(X_train,y_train)<jupyter_output>/usr/local/lib/python3.7/dist-packages/sklearn/utils/deprecation.py:87: FutureWarning: Function safe_indexing is deprecated; safe_indexing is deprecated in version 0.22 and will be removed in version 0.24.
  warnings.warn(msg, category=FutureWarning)
/usr/local/lib/python3.7/dist-packages/sklearn/utils/deprecation.py:87: FutureWarning: Function safe_indexing is deprecated; safe_indexing is deprecated in version 0.22 and will be removed in version 0.24.
  warnings.warn(msg, category=FutureWarning)<jupyter_text>Running the neural network model without addressing the class imbalance problem<jupyter_code>model = Sequential([
    Dense(128, activation = 'relu', input_shape = [62, ]),
    Dropout(0.2),
    Dense(64, activation = 'relu'),
    Dropout(0.2),
    Dense(32, activation = 'relu'),
    Dropout(0.2), 
    Dense(16, activation = 'relu'),
    Dropout(0.2), 
    Dense(2, activation = 'softmax')
])

model.summary()
model.compile(loss = 'binary_crossentropy', optimizer = 'adam', 
              metrics = ['accuracy'])
#Changing the shape of y
y_train = to_categorical(y_train)

#Train Validation Split
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, 
                                                    test_size = 0.2, 
                                                    random_state = 101)
early_stop = EarlyStopping(monitor='val_loss', mode='min', verbose=1, patience=25)
model.fit(X_train, y_train, epochs = 100, batch_size = 100, 
          validation_data = (X_val, y_val), verbose=1, callbacks=[early_stop])
losses = pd.DataFrame(model.history.history)

losses[['loss','val_loss']].plot()
#prediction without addressing the class imbalance problem using SMOTE
predictions = model.predict_classes(X_test)

print(classification_report(y_test,predictions))<jupyter_output>/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/sequential.py:455: UserWarning: `model.predict_classes()` is deprecated and will be removed after 2021-01-01. Please use instead:* `np.argmax(model.predict(x), axis=-1)`,   if your model does multi-class classification   (e.g. if it uses a `softmax` last-layer activation).* `(model.predict(x) > 0.5).astype("int32")`,   if your model does binary classification   (e.g. if it uses a `sigmoid` last-layer activation).
  warnings.warn('`model.predict_classes()` is deprecated and '<jupyter_text>Running the neural network model after addressing the class imbalance problem using SMOTE<jupyter_code>#Changing the shape of y
y_train1 = to_categorical(y_train1)

#Train Validation Split
X_train1, X_val1, y_train1, y_val1 = train_test_split(X_train1, y_train1, 
                                                    test_size = 0.2, 
                                                    random_state = 101)
model.fit(X_train1, y_train1, epochs = 100, batch_size = 100, 
          validation_data = (X_val1, y_val1), verbose=1, callbacks=[early_stop])
losses = pd.DataFrame(model.history.history)

losses[['loss','val_loss']].plot()
#prediction after addressing the class imbalance problem using SMOTE
predictions = model.predict_classes(X_test)

print(classification_report(y_test,predictions))<jupyter_output>/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/sequential.py:455: UserWarning: `model.predict_classes()` is deprecated and will be removed after 2021-01-01. Please use instead:* `np.argmax(model.predict(x), axis=-1)`,   if your model does multi-class classification   (e.g. if it uses a `softmax` last-layer activation).* `(model.predict(x) > 0.5).astype("int32")`,   if your model does binary classification   (e.g. if it uses a `sigmoid` last-layer activation).
  warnings.warn('`model.predict_classes()` is deprecated and '
{'fraction_non_alphanumeric': 0.1157337367624811, 'fraction_numerical': 0.03000504286434695, 'mean_word_length': 4.131953428201811, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '303304', 'license': 'MIT', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1233, 'n_words': 302, 'path': 'NN.ipynb', 'repo_name': 'AniNair14/Bank-Marketing-Analysis', 'size': '3966'}