Skip to main content

Project 01: Employee Attrition Prediction

1.6 - Model Selection

πŸ”–
One has to experiment on different models and check its performance with test data. The model with high accuracy will predict outcome better.

Use frameworks like TensorFlow, PyTorch, or Scikit-learn to build and experiment with different models.

Logistic Regression

It predicts the probability of an instance belonging to a particular class. In other words, it predicts which class a new data will belongs to based on outcome of probability. 

This algorithm uses sigmoid function, which is a mathematical function used to map the predicted values to probabilities. It maps any real value into another value within a range of 0 and 1.

# Logistic regression

from sklearn.linear_model import LogisticRegression

lr = LogisticRegression()
model_lr = lr.fit(X_train, y_train)

# predict outcome with test data
y_pred_lr = model_lr.predict(X_test)

Then evaluate the model's performance using a test dataset.