1. Homepage
  2. Programming
  3. Assignment 2: Logistic Regression and Support Vector Classifier

Assignment 2: Logistic Regression and Support Vector Classifier

Engage in a Conversation
Hong KongHKBUIntroduction to Big Data AnalyticsLogistic RegressionSupport Vector ClassifierPythonRSmoking

  CourseNana.COM

Assignment 2 CourseNana.COM

Question 1. [30 points] Suppose we collect data for a group of students in a statistics class with variables ?! = h???? ??????? , ?" = ?????????? ??? , and ? = 1 if the student receives an A and ? = 0 otherwise. We fit a logistic regression and produce estimated coefficient, ?# = −6, ?! = 0.05, ?" = 1. CourseNana.COM

  1. (a)  Estimate the probability that a student who studies for 40 hours and has a cumulative GPA of 3.5 gets an A in the class.
  2. (b)  How many hours would the student in part (a) need to study to have a 50% chance of getting an A in the class?
  3. (c)  What is the odds ratio and log-odds for the student in (a)?
  4. (d)  Write down the function of linear hyperplane in a figure where ?! is on the ?-axis and ?" on the ?-axis. Also indicate the region for A grade (positive, ? = 1) and region for non-A grade (negative) in the figure.

Question 2. [20 points] CourseNana.COM

  1. (a)  Suppose that an individual has a 18% chance of defaulting on her credit card (positive, ? = 1) payment. What is the odds-ratio? (Round the result to 2 decimal places)
  2. (b)  Suppose the odds-ratio of defaulting on credit card payment for a man is 0.4, what is the probability this person will default on his credit card payment? (Save the result as percentage and round it to 2 decimal places)

Question 3. [20 points] A support vector classifier was fit to a small data set with 12 instances. The colors indicate their classes (Blue represents positive and red represents negative). The hyperplane (solid line) and the two margins (dashed lines) are plotted in the following figure. CourseNana.COM

(a) List the number of instances that are support vectors. CourseNana.COM

  1.  (b)  Suppose instance 4 (the red dot in the figure) moves closer to the margin. Will it affect the hyperplane?
  2. (c)  List the number of instances that move across its margin while not the hyperplane.
  3. (d)  List the number of instances that move across the hyperplane.

Question 4. Logistic Regression: Programming [30 points]
Please use the dataset Smoking.csv and write python codes to answer questions below CourseNana.COM

step by step. Please report both codes and outputs. CourseNana.COM

  1. (a)  How many observations are there? How many smokers are there (?????? = 1)?
  2. (b)  Split the data into training (70%) and test set (30%). Set random_state = 0. Scale the features/predictors using the MinMaxScaler.
  3. (c)  Train a logistic regression model on training data, with ?????? as target variable and smoke ban (??????) and age (???) as features. Display the intercepts and coefficients. How can you interpret the coefficient for age (???)?
  4. (d)  Check model accuracy on test data. What is the model accuracy if we take 0.5 (default) as the cutting point in predicting class labels? (Hint: you may need to apply
  5.  the scaler on test data before making any prediction)


CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Hong Kong代写,HKBU代写,Introduction to Big Data Analytics代写,Logistic Regression代写,Support Vector Classifier代写,Python代写,R代写,Smoking代写,Hong Kong代编,HKBU代编,Introduction to Big Data Analytics代编,Logistic Regression代编,Support Vector Classifier代编,Python代编,R代编,Smoking代编,Hong Kong代考,HKBU代考,Introduction to Big Data Analytics代考,Logistic Regression代考,Support Vector Classifier代考,Python代考,R代考,Smoking代考,Hong Konghelp,HKBUhelp,Introduction to Big Data Analyticshelp,Logistic Regressionhelp,Support Vector Classifierhelp,Pythonhelp,Rhelp,Smokinghelp,Hong Kong作业代写,HKBU作业代写,Introduction to Big Data Analytics作业代写,Logistic Regression作业代写,Support Vector Classifier作业代写,Python作业代写,R作业代写,Smoking作业代写,Hong Kong编程代写,HKBU编程代写,Introduction to Big Data Analytics编程代写,Logistic Regression编程代写,Support Vector Classifier编程代写,Python编程代写,R编程代写,Smoking编程代写,Hong Kongprogramming help,HKBUprogramming help,Introduction to Big Data Analyticsprogramming help,Logistic Regressionprogramming help,Support Vector Classifierprogramming help,Pythonprogramming help,Rprogramming help,Smokingprogramming help,Hong Kongassignment help,HKBUassignment help,Introduction to Big Data Analyticsassignment help,Logistic Regressionassignment help,Support Vector Classifierassignment help,Pythonassignment help,Rassignment help,Smokingassignment help,Hong Kongsolution,HKBUsolution,Introduction to Big Data Analyticssolution,Logistic Regressionsolution,Support Vector Classifiersolution,Pythonsolution,Rsolution,Smokingsolution,