Logistic Regression
Logistic Regression
For example, the effects of a number of factors on the development or otherwise of a disease. A patient may be cured or
not; a prospect may respond or not, should we grant a loan to particular person or not, etc.
When the outcome or dependent variable is binary, and we wish to measure the effects of several independent variables on
it, we uses Logistic Regression
Data is obtained in ▪ Missing Value Imputation Independent and dependent ▪ FA is done in order to
pandas dataframe ▪ Trash value variables should be identified get the variables into
▪ Outlier Treatment groups
▪ Good to choose factor
solution near the Eigen
value of 1
▪ As a further Check
Correlation Analysis is
done
Divide data into ▪ Assume all assumptions ▪ Validate the output on Results will be
Development and hold the Validation sample , presented in
Validation Sample in ▪ Check for the by running the same PowerPoint
ratio 70:30 or 80:20 significance of the model on the Validation
variables sample
▪ Run Regression on
Development sample
Python code
Step 1: Importing the dataset
dataset = pd.read_csv(‘car_purchase_Ads.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
Step 2: Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0)
Analytics Blog