In this post we will learn Logistic Regression and real life example.

Logistic regression is a supervised machine learning which is used for classification problems or we can say it is used to find the probability of target variable which is the form in binary or discrete 0 and 1.

It represents by simple sigmoid function:

Output goes between 0 and 1.

Here the simple curve which is used to represent this sigmoid curve:

The middle value of this curve (0.5) is called the “threshold values”

It divided into the two categories, class1 and class2,

if value is less than 0.5 that means it assign to class1 and value set as 0.

And if the value is greater than 0.5 than it goes to the class2 and value set as 1.

Sklearn Example:

```
# importing required libraries
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
# train and test dataset
train_data = pd.read_csv('train-data.csv')
test_data = pd.read_csv('test-data.csv')
print(train_data.head())
# shape of the dataset
print('Shape of training data :',train_data.shape)
print('Shape of testing data :',test_data.shape)
# seperate the independent and target variable on training data
x_train = train_data.drop(columns=['Income'],axis=1)
y_train = train_data['Income']
# seperate the independent and target variable on testing data
x_test = test_data.drop(columns=['Income'],axis=1)
y_test = test_data['Income']
model = LogisticRegression()
# fit the model with the training data
model.fit(x_train,y_train)
# coefficients of the trained model
print('Coefficient of model :', model.coef_)
# intercept of the model
print('Intercept of model',model.intercept_)
# predict the target on the train dataset
predict_train = model.predict(x_train)
print('Target on train data',predict_train)
# Accuray Score on train dataset
accuracy_train = accuracy_score(y_train,predict_train)
print('accuracy_score on train dataset : ', accuracy_train)
# predict the target on the test dataset
predict_test = model.predict(x_test)
print('Target on test data',predict_test)
# Accuracy Score on test dataset
accuracy_test = accuracy_score(y_test,predict_test)
print('accuracy_score on test dataset : ', accuracy_test)
```

Loads of individuals post horrible pictures on dating sites and generally speaking they most likely would have accomplished improved results by posting no photos by any means! Be that as it

photos for dating profilemay what sorts of pictures ought to be kept away from no matter what while compelling a dating profile