采用牛顿法求解对数概率回归模型。
# Experiment 4: Logistic Regression and Newton's Method
This is the report of Experiment 4: Logistic Regression and Newton's Method.
# Purpose
In this experiment, we want to implement logistic regression on a classification problem.
The value of inputs are each students' score on two standardized exams. The value of is a label of whether the student was admitted.
# Hypothesis
We hypothesize that there exists that for each , the probability can be written as .
# Procedure
The predict question is a classification problem.With the hypothesis, we want to divide all data points into two groups by a line, the positive group is the students were admitted, the negative group is the students were not admitted. Now, I'll find the line with Newton's Method.
We predict the possibility with the hypothesis function
Through maximum likelihood estimation, the logarithm of likelihood function is
We want to minimize the function with Newton's method, whose update rule is
The gradient is
The inverse of Hessian is
So we can calculate the with Newton's method. After convergence, we need to draw the decision boundary of this classification problem. The line satisfies that
which means
# Answer of the questions
# Question 1
After iterations, I got the is
# Question 2
The probability that a student with a score of on Exam 1 and a score of on Exam 2 is .