# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import numpy as np
import pickle
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier

df = pd.read_csv('./Dataset/train_selected_cleaned_reduced.csv')

df.head()

df.shape

# +
X = np.array(df.loc[:, df.columns != 'prognosis'])  # 1200x10
y = np.array(df.loc[:, df.columns == 'prognosis'])  # 1200x1
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.20, random_state=37)


# -

classifier = MLPClassifier(hidden_layer_sizes=(25,15), max_iter=300,activation = 'relu',solver='adam',random_state=1)

classifier.fit(X_train,y_train.ravel())

score = classifier.score(X_test,y_test)
print(score)

classifier.predict([[1,1,0,0,0,0,0,0,0,0]])

pickle.dump(classifier,open('medpredMLP.pickle','wb'))





StarcoderdataJupyterScriptsDedupFiltered