100% found this document useful (3 votes)
1K views

Answer

The document contains questions and answers related to logistic regression. It discusses that logistic regression is used for classification problems when the dependent variable is categorical. Linear regression is used when the dependent variable is continuous. It also provides the accuracy, true positives, intercept value, and AUC score of a logistic regression model built on a prisoner recidivism dataset without preprocessing.

Uploaded by

sonali Pradhan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
1K views

Answer

The document contains questions and answers related to logistic regression. It discusses that logistic regression is used for classification problems when the dependent variable is categorical. Linear regression is used when the dependent variable is continuous. It also provides the accuracy, true positives, intercept value, and AUC score of a logistic regression model built on a prisoner recidivism dataset without preprocessing.

Uploaded by

sonali Pradhan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Q No: 

Correct Answer
Marks: 1/1

Logistic Regression is applied when the Dependent Variable is of Continuous nature.

Select True or False.

True

False
You Selected

Logistic Regression is used for classification problems, i.e. when the dependent variable is of
Categorical Nature. For Example, Good or Not Good, Guilty or Not Guilty, Defaulter or Not a
defaulter etc.

On the contrary, when you are trying to predict a Continuous Variable, you can choose to use
Linear Regression. For example, Price of a commodity, Run Rate of a Batsman etc.

Q No: 2

Correct Answer
Marks: 1/1

If ln(odds) of an event is 0, what is the probability of that event?

Note: 'ln' refers to the natural logarithm (i.e. logarithm to the base  )

0.5
You Selected
1

None of the mentioned.

Follows from the definition.

In this case, we know that ln(P/(1-P) = 0. So, for the equation to be 0 we need to have P = 1-P (as
ln(1) = 0). Thus, we can say that P=1-P=0.5.

Q No: 3

Correct Answer
Marks: 1/1

The following table shows the cross-tabulation of actual and predicted response after a logistic
regression model fit. What is the accuracy of the logistic regression?

 
  Actual Good Actual Bad

Predicted Good 2300 180

Predicted Bad 200 820

0.11

0.82

0.89
You Selected
0.92

Accuracy = (TP+TN)/ (TP+TN+FP+FN)

Accuracy = (2300+820)/(2300+180+200+820) = 0.89

Q No: 4

Correct Answer
Marks: 1/1
What do we plot (in the X-axis and the Y-axis) in the Receiver Operator Characteristic (ROC)
curve?

X-axis : False Positive Rate, Y-axis : True Positive Rate


You Selected
X-axis : True Positive Rate, Y-axis : False Positive Rate

X-axis : Accuracy, Y-axis : Misclassification Rate

X-axis : False Negative Rate, Y-axis : True Negative Rate


Q No: 5

Correct Answer
Marks: 1/1

To predict whether a heart attack is fatal, logistic regression is fitted. Y = 1, if the attack is fatal, 0
otherwise. The following model is found to be adequate

 = -8.5 + 0.2*Age + 0.15*Smoking Status [here 'ln' stands for natural


logarithm (i.e. logarithm to the base  )]

Where Smoking Status = 1 if the person is a current smoker and 0 otherwise. Find the percentage
probability that a 50-year-old non-smoker will have a fatal attack.
84.2%

81.75%
You Selected
82.34%

89.71%

Putting the required value in the log-odds equation we get:

 = -8.5 + 0.2*(50) + 0.15*(0) = 1.5

Pr(Y = 1) = exp(1.5)/(1+exp(1.5)) = 0.8175

Q No: 6

Correct Answer
Marks: 1.50/1.50

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.

Build a Logistic Regression Model on the data set.


What is the value of the accuracy score on the data?

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

0.85625

0.78256

0.8411
You Selected
0.7921
Q No: 7

Correct Answer
Marks: 1.50/1.50

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.
Build a Logistic Regression Model on the data set.

What is the value of the True Positives predictions based on the confusion matrix?

Note: For this question, use the whole data to build the model, then use the independent
variables to predict the same whole data and then build a confusion matrix.

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

480
You Selected
674

140

78
In python, when you print the confusion matrix it is understood like this:

0 1
0 674 140
1 78 480

 0,1 represents the class predicted. 0 comes first.

True Positive is when the actual class is 1 and the model predicted it to be 1 as well. Thus, for
index location [1,1] is the true positive in the given confusion matrix i.e. 480.

Try this code from


documentation: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_ma
trix.htmlLinks to an external site.
tn, fp, fn, tp = metrics.confusion_matrix(actuals,predicted).ravel()
print('Number of True Positives is ',tp)

Output: # of True Positives is 480

Q No: 8

Correct Answer
Marks: 1/1

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.

Build a Logistic Regression Model on the full data set.

Select True or False for the following statement.


The value of the intercept of the model is greater than 1.

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

True

False
You Selected
Q No: 9

Correct Answer
Marks: 1/1

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.

Build a Logistic Regression Model on the data set

Obtain the predictions for the data set.

What is the Area Under the Curve Score on the Data?

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

0.852
You Selected
0.72

0.67

0.50

You might also like