Larix / Logistic_Regression

邏輯迴歸(logistic regression)之實作範例

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logistic Regression

此專案使用iris-dataset作為數據集實現邏輯迴歸(logistic regression)之實作範例

This is a demo that implements logistic regression use "Stochastic gradient descent" and use iris-dataset as training data

Output:

Use iris flower type 0 as training set:

image image

COST & ACCURACY:

epoch = 1.0: current_cost =  75.0
epoch = 2.0: current_cost =  25.16688174495742
epoch = 3.0: current_cost =  23.29147281236411
epoch = 4.0: current_cost =  23.03560378198325
epoch = 5.0: current_cost =  23.003599265654483
epoch = 6.0: current_cost =  23.000056624979727
epoch = 7.0: current_cost =  22.999522313103633
epoch = 8.0: current_cost =  22.99946609494237
epoch = 9.0: current_cost =  22.99945611397478
epoch = 10.0: current_cost =  22.999455010881736
epoch = 11.0: current_cost =  22.99945484092891
epoch = 12.0: current_cost =  22.999454818252065
epoch = 13.0: current_cost =  22.999454815241478
epoch = 14.0: current_cost =  22.999454814876135
epoch = 15.0: current_cost =  22.99945481482544
Accuracy:  100.0 %

Use iris flower type 2 as training set:

image image

COST & ACCURACY:

epoch = 1.0: current_cost =  75.0
epoch = 2.0: current_cost =  50.906669549819135
epoch = 3.0: current_cost =  47.12629123955934
epoch = 4.0: current_cost =  46.95585632090819
epoch = 5.0: current_cost =  47.02138551470156
epoch = 6.0: current_cost =  47.01995479607884
epoch = 7.0: current_cost =  47.01924855794931
epoch = 8.0: current_cost =  47.019204569417276
epoch = 9.0: current_cost =  47.01918339266448
epoch = 10.0: current_cost =  47.01918241549116
epoch = 11.0: current_cost =  47.019182330950834
epoch = 12.0: current_cost =  47.01918232065727
epoch = 13.0: current_cost =  47.019182318889094
epoch = 14.0: current_cost =  47.01918231809409
epoch = 15.0: current_cost =  47.019182317967015
Accuracy:  93.33 %

About

邏輯迴歸(logistic regression)之實作範例


Languages

Language:Python 100.0%