<jupyter_start><jupyter_text>Pandas Profiling need to stydy<jupyter_code>lst = list(df.columns)
for item in lst:
    print(item,"The number of null values are ",np.sum(df[item].isna()))<jupyter_output>Pregnancies The number of null values are  0
Glucose The number of null values are  0
BloodPressure The number of null values are  0
SkinThickness The number of null values are  0
Insulin The number of null values are  0
BMI The number of null values are  0
DiabetesPedigreeFunction The number of null values are  0
Age The number of null values are  0
Outcome The number of null values are  0<jupyter_text>Building ML Models<jupyter_code>from sklearn.model_selection import train_test_split
X = df.drop(['Outcome'], axis=1)
X
y=df['Outcome']
X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.33, random_state=42)
X_train.shape
type(X_test)
y_train.shape
type(y_test)
LST = [X_train, X_test, y_train, y_test]
for item in LST:
     item.shape
y_test
from sklearn.linear_model import LogisticRegression

model = LogisticRegression(verbose=True)

model.fit(X_train,y_train)

prediction = model.predict(X_test)
prediction
from sklearn.metrics import classification_report,roc_auc_score,roc_curve
print(classification_report(y_test,prediction))
roc_auc_score(y_test,prediction)
from sklearn.ensemble import RandomForestClassifier
%time
lst = [100,110,120,150,200,300,400]
lst_roc = []
for i in lst: 
    model = RandomForestClassifier(n_estimators=i)
    model.fit(X_train,y_train)
    prediction = model.predict(X_test)
    print(classification_report(y_test,prediction))
    print(roc_auc_score(y_test,prediction))
    lst_roc.append(roc_auc_score(y_test,prediction))
    
plt.plot(lst,lst_roc)
lst_roc
#prediction

      
roc_auc_score(y_test,prediction)
from sklearn.svm import SVC,SVR
model = SVR(verbose=True)
model.fit(X_train,y_train)
prediction = model.predict(X_test)
print(classification_report(y_test,prediction))
print(roc_auc_score(y_test,prediction))
lst_roc.append(roc_auc_score(y_test,prediction))
# Gradientboosting 
# lightgbm
# xgboost
model_final = RandomForestClassifier(n_estimators=200)
model_final.fit(X_train,y_train)
import pickle
filename = 'diabetes-prediction-rfc-model.pkl'
pickle.dump(model_final, open(filename, 'wb'))
def unpickle(filename):
    f = open(filename, "rb")
    d = pickle.load(f)
    f.close()
    return d
model_unpickle = unpickle('diabetes-prediction-rfc-model.pkl')
prediction = model_unpickle.predict(X_test)
print(classification_report(y_test,prediction))
print(roc_auc_score(y_test,prediction))
lst_roc.append(roc_auc_score(y_test,prediction))
x_input= []
for x in X_test.columns:
    print('Enter the value of ', x)
    i = eval(input())
    x_input.append(i)
#x_input = [1,150,120,10,70,34,0.67,42]
#df = np.reshape(x_input,(1,8))
df = np.array([x_input])
df = pd.DataFrame(np.reshape(x_input,(1,8)))
model_unpickle.predict(df)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10678949164107814, 'fraction_numerical': 0.020812009553053564, 'mean_word_length': 6.576227390180879, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '420421', 'license': 'MIT', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1090, 'n_words': 226, 'path': 'Untitled.ipynb', 'repo_name': 'MANUJMEHROTRA/ML-Deployement', 'size': '2931'}