Sunday, March 22, 2020

[tensorflow certification] 2-3. What's the binary classification(machine learning which algorithm is explained by python programming)




 Hello. I'm DVM who talk about tensorflow certification
Today, I will explain the basic Concept about Binary Regression.
If you haven't seen the previous lecture,
I recommend that watch the previous lecture.

First. What's the Binary Classification?
Wikipedia said that
Binary or binomial classification is the task of classifying 
the elements of a given set into two groups. 
It is used to estimate whether to increase or fall in stock.




Second. How to make Binary Classification ?
The sigmoid function is used for binary classification.
The sigmoid function is expressed as a value from 0 to 1.
It is useful when returnning the value as True and False.
For example, Value is less than 0.5, It is False .
and Value is more than 0.5, It is True.


 But If you use the mean square error as a cost function.
when you have a sigmoid as hypothesis function.
the graph is not smooth because of exponential function.


 Third. How to avoid local minimum?
If you use the cost function as a log function, you can reduce the shaking of the
graph of exponential function.
Because exponential and log functions are good combinations.

t is answer label. 
you have to use 0 or 1. which is called one-hot-encoding.
y is your estimated value.
d is delta value . If estimated value is zero, 
cost function is possible to have infinity value.
so if you add delta, you could prevent infinity of cost function.


 Let's analyze the cross entropy as shown in the graph.
if answer label is 1 and your estimated value is 1, your cost value is low.
if answer label is 1 and your estimated value is 0, your cost value is high.
if answer label is 0, then your cost value is 0, so we don't need to consider.
As a reuslt, If you use cross entropy, you could avoid local minimum well.

Fourth. .What is the Binary Cross Entropy? 
If you are solving the binary classification problem, 
It is better to use binary cross entropy than cross entropy.
The reason is that cross entropy consider the cost function when answer is 1, 
but binary cross entropy considers the cost function
when the correct answers is 0 and 1.

 Let's analyze the binary cross entropy.
if answer label is 1 and your estimated value is 1, your cost value is low.
if answer label is 1 and your estimated value is 0, your cost value is high.
if answer label is 0, then your estimated value is 1, your cost value is high.
if answer label is 0, then your estimated value is 0, your cost value is low.
FIfth. Practice using tensorflow
Let's make a Linear Regression using tensorflow
In this lecture, We Compare mean square error with binary cross entropy.

As a result, Prediction of binary cross entropy is better than mean square error.

sixth. Exam.
Let's solve the problem and if wrong, 
please watch this video again from the beginnig untill get 100 points.
First.What's the Binary Classification?


Binary or binomial classification is the task
of classifying the elements of a given set into two groups

Second.  When we used to sigmoid function?

The sigmoid function is used for Binary Classification
Third. How to avoid local minimum when use sigmoid?

Cross Entropy Cost Function


Fourth, Is this Binary Cross Entropy?

No, It is Binary Cross Entropy.


No comments:

Post a Comment