Binary Classification Models in Machine Learning

preview_player
Показать описание
Read the Dataset
import pandas as pd

Convert categorical to numerical:
df[[columns]]=df[columns]].apply(LabelEncoder().fit_transform)

X and Y

X_train,X_val,Y_train,Y_val=train_test_split(X,Y,test_size=0.2,random_state=42)

To create more than one model
models = {} //dictionary

# Logistic Regression
models['Logistic Regression'] = LogisticRegression()
#similary create other models

accuracy, precision, recall = {}, {}, {}

# Fit the classifier model
models[key].fit(X_train, Y_train)

# Prediction
predictions = models[key].predict(X_val)

# Calculate Accuracy, Precision and Recall Metrics
accuracy[key] = accuracy_score(predictions, Y_val)
precision[key] = precision_score(predictions, Y_val)
recall[key] = recall_score(predictions, Y_val)
Y_predict = models[key].predict(X_val)
auc = roc_auc_score(Y_val, Y_predict)
print('Classification Report:',key)
print(classification_report(Y_val,predictions))
false_positive_rate, true_positive_rate, thresholds = roc_curve(Y_val, predictions)
print('ROC_AUC_SCORE is',roc_auc_score(Y_val, predictions))

#fpr, tpr, _ = roc_curve(y_test, predictions[:,1])

Binary Classification: In binary classification, the goal is to classify the input into one of two classes or categories. Example – On the basis of the given health conditions of a person, we have to determine whether the person has a certain disease or not.
Рекомендации по теме
Комментарии
Автор

Its 5.08 AM and today is my midterm exam and our AI teacher teaches us by copying the lectures of Stanford university. He didn't even tell us that Logistic Regression Neutral Networks are algorithms used for Binary Classification. And he is going to give us problems in exams related to all these. But thanks for showing us how things are practically done.

codewithkhurram
Автор

Thanks for the wonderful video mam! I have a doubt. Do we require to do feature scaling of all numerical variables before fitting the models or these models take care of it automatically?

yashodharpathak
Автор

predictions = models[key].predict(X_val)
Y_predict = models[key].predict(X_val)
why do you use two variable, acctully are same ?

Go-ygrg
Автор

Dataset need him mam please share you mam

fireninjagaming
Автор

Hi mam enakku DL la orusila doubts irukku mam
Unga insta id kudunga mam
Naa voice note mooliyama explain panren. Enakku help pannunga mam please mam please

mudhassir.