<jupyter_start><jupyter_text>Exploring the Data<jupyter_code>df.shape
df.info()

print(Counter(df['status']))
df.isnull().sum()<jupyter_output><empty_output><jupyter_text>Data preprocessing<jupyter_code>X = df.drop(['name','status'],axis=1)
y = df['status']

x_train, x_test, y_train, y_test = train_test_split(X,y,test_size=0.2,random_state=seed)<jupyter_output><empty_output><jupyter_text>Logistic Regression<jupyter_code>parameters = {'penalty': ['l1', 'l2'], 
              'C': [0.1, 0.4, 0.8, 1, 2, 5,10,20,30]}    

grid_search=GridSearchCV(estimator=LogisticRegression() ,param_grid=parameters,cv=10,n_jobs=-1,verbose=2)
grid_search.fit(x_train,y_train)

log_reg = grid_search.best_estimator_

grid_search.best_params_
y_pred=log_reg.predict(x_test)

print("\n",confusion_matrix(y_test,y_pred))
log_reg_acc = accuracy_score(y_test,y_pred)

print("\nAccuracy Score {}".format(log_reg_acc))<jupyter_output>[[ 3  4]
 [ 0 32]]

Accuracy Score 0.8974358974358975<jupyter_text>Support Vector Classifier<jupyter_code>from sklearn.svm import LinearSVC

svc = LinearSVC()

parameters = {
      'penalty':['l1', 'l2'],
      'max_iter': [10,20,50,100,1000], 
      'C': [0.1, 0.4, 0.8, 1, 2, 5,10,20,30],          
              }

grid_search=GridSearchCV(estimator=svc ,param_grid=parameters,cv=10,n_jobs=-1,verbose=2)
grid_search.fit(x_train,y_train)

svc = grid_search.best_estimator_

grid_search.best_params_
y_pred=svc.predict(x_test)

print("\n",confusion_matrix(y_test,y_pred))
svc_acc = accuracy_score(y_test,y_pred)
print("\nAccuracy Score {}".format(svc_acc))<jupyter_output>[[ 0  7]
 [ 0 32]]

Accuracy Score 0.8205128205128205<jupyter_text>Extreme Gradient Boosting<jupyter_code>xgb = XGBClassifier()

parameters = {'min_child_weight' : np.arange(0,20),
              'max_depth': [2, 4, 5, 7, 9, 10]}

grid_search=GridSearchCV(estimator=xgb ,param_grid=parameters,cv=10,n_jobs=-1,verbose=2)
grid_search.fit(x_train,y_train)

xgb = grid_search.best_estimator_

grid_search.best_params_
y_pred=xgb.predict(x_test)

print("\n",confusion_matrix(y_test,y_pred))
xgb_acc = accuracy_score(y_test,y_pred)
print("\nAccuracy Score {}".format(xgb_acc))<jupyter_output>[[ 5  2]
 [ 0 32]]

Accuracy Score 0.9487179487179487<jupyter_text>Stacking Ensemble Classifier<jupyter_code>estimators = [ ('xgb', xgb ), 
              ('svc',svc ),
              ('log_Reg', log_reg)]


stack =StackingClassifier(estimators=estimators ,final_estimator= svc)

stack.fit(x_train,y_train)
stack_predicted = stack.predict(x_test)

stack_conf_matrix = confusion_matrix(y_test, stack_predicted)
stack_acc_score = accuracy_score(y_test, stack_predicted)

print("confussion matrix")
print(stack_conf_matrix)
print("\n")
print("Accuracy of Stacking Classifier:",stack_acc_score*100,'\n')<jupyter_output>/home/deepalakshmi/.local/lib/python3.8/site-packages/xgboost/sklearn.py:1146: UserWarning: The use of label encoder in XGBClassifier is deprecated and will be removed in a future release. To remove this warning, do the following: 1) Pass option use_label_encoder=False when constructing XGBClassifier object; and 2) Encode your labels (y) as integers starting with 0, i.e. 0, 1, 2, ..., [num_class - 1].
  warnings.warn(label_encoder_deprecation_msg, UserWarning)
{'fraction_non_alphanumeric': 0.14136125654450263, 'fraction_numerical': 0.047428395441946415, 'mean_word_length': 6.518518518518518, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '432659', 'license': 'MIT', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1277, 'n_words': 198, 'path': 'Parkinson Disease Detection.ipynb', 'repo_name': 'Divyakathirvel26/Parkinson-Disease-Detection', 'size': '3247'}