Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.10 LAB: Evaluating logistic regression using LogisticRegression() Using the csv file nbaallelo_log.csv and the LogisticRegression function, construct a logistic regression model to classify whether a

5.10 LAB: Evaluating logistic regression using LogisticRegression() Using the csv file nbaallelo_log.csv and the LogisticRegression function, construct a logistic regression model to classify whether a team will win or lose a game based on the team's elo_i score and evaluate the model. Read in the file nbaaello_log.csv. The target feature will be converted from string to a binary feature by the provided code. Split the data into 70 percent training set and 30 percent testing set. Set random_state = 0. Use the LogisticRegression function to construct a logistic regression model with wins as the target and elo_i as the predictor. Use the test set to predict the wins from the elo_i score. Construct and print the confusion matrix. Calculate and print the sensitivity. Calculate and print the specificity. Note: Use ravel() from numpy to flatten the second argument of LogisticRegression.fit() into a 1-D array. Ex: If the feature pts is used as the predictor, rather than elo_i, the output is: confusion matrix is [[12220 6730] [ 6530 12415]] Sensitivity is 0.644855 Specificity is 0.655318

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Engineering Mathematics

Authors: ERWIN KREYSZIG

9th Edition

0471488852, 978-0471488859

More Books

Students also viewed these Mathematics questions

Question

107 MA ammeter 56 resistor ? V voltmeter

Answered: 1 week ago

Question

Generally If Drug A is an inducer of Drug B , Drug B levels will

Answered: 1 week ago