Logistic Regression is an alogirthm for Binary Classification
An example of a Binary Classification Problem :
first training example
: (, )second training example
: (, )last training example
: (, )training set
: { }To emphasize the number of training samples
: To output all of the training example
: , Python Command
Logistic Regression
is a algorithm that you use when the output labels Y in a supervised learning problem are all either zero or one,How to generalize the output
:
This is not a very good algorithm for binary classification.
왜냐하면, 우리는 이 일 확률이 되기를 원한다.
그래서 이 0~1 사이의 값을 갖아야 한다.
하지만 는 1보다 크거나, 음수의 값을 가질 수 있기 때문에
Probability에 합당하지 않다.
: 따라서 을 sigmoid function, 에 적용한 값을 사용한다.
Sigmoid Function
looks likeTo train the parameters , of logistic regression model
Wee need to define a cost function
.
, where
Given {,..., }, want
Loss Function = Error Function
:
it measures how well you're doing on a single training example.
Cost Function
:
it measures how are you doing on the entire training set.
Our logistic regression model,
we're going to try to find parameters and
that minimize the overall Cost Function
recap
:convex function
: 간단히 말하면 아래로 볼록한 함수.Assumption
: Cost Function is a convex functionGradient descent algorithm
: To train or to learn the parameters on our training set.Derivative just means slope of a function
formal definition
: This go up three times as much as
whatever was the tiny, tiny, tiny, amount(infinitesimal amount) that we nudged to the right
아래 예제에서는 직관적인 이해를 위해 0.001 축 방향 0.001 이동시켰지만,
실제 derivatives의 정의는 무한히 작은 값(infinitesimal amount)을 이동시킨다.
Derivatives
formula :
formula :
The computation of a neural network are organized in terms of a
forward pass
(= forward propagation step) in which we compute the output of the neural network
followed by a backward pass
(= backward propagation step) which we use to compute gradients or compute derivatives.
The computation graph explains why it is organized this way
Simple example
:
변수 를 사용하는 function 가 있다고 가정하자.
Key Point
:
Computing all of these derivatives,
the most efficient way to do so is through a right to left computation
following the direction of the red arrows.
1. 먼저 에 대한 derivatives를 계산
2. 그러면 에 대한 derivative와 에 대한 derivative를 계산하는 데 유용.
3. 그러면 , 각각에 대한 derivative 계산하는 데 유용
remind
:Logistic regression on m examples
:vectorization
이 매우 중요해졌다.