资源简介

逻辑回归实战详细代码,含注释。逻辑回归利用最优化算法梯度下降来找最佳回归系数。用其做实战预测疝气病症的病马死亡率。

资源截图

代码片段和文件信息

‘‘‘
Created on June 92018
do logregers_gradAscent
@author: zhe
‘‘‘

import logRegres
from numpy import *

dataArrlabelMat = logRegres.loadDataSet()

logRegres.gradAscent(dataArrlabelMat)

weights = logRegres.gradAscent(dataArrlabelMat)

logRegres.plotBestFit(weights.getA())

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-07-13 15:00  Logistics_Regression\__pycache__\
     文件        1871  2018-06-09 16:28  Logistics_Regression\__pycache__\logRegres.cpython-36.pyc
     目录           0  2018-07-13 15:00  Logistics_Regression\5.1_logRegres_gradAscent\
     目录           0  2018-07-13 15:00  Logistics_Regression\5.1_logRegres_gradAscent\__pycache__\
     文件        1952  2018-07-10 15:34  Logistics_Regression\5.1_logRegres_gradAscent\__pycache__\logRegres.cpython-36.pyc
     文件         278  2018-06-10 11:54  Logistics_Regression\5.1_logRegres_gradAscent\do_logRegres.py
     文件        1816  2018-07-10 15:33  Logistics_Regression\5.1_logRegres_gradAscent\logRegres.py
     文件       15837  2018-07-10 15:34  Logistics_Regression\5.1_logRegres_gradAscent\LogRegres_GradAscent.eps
     文件        2187  2010-10-29 06:46  Logistics_Regression\5.1_logRegres_gradAscent\testSet.txt
     目录           0  2018-07-13 15:00  Logistics_Regression\5.2_logRegres_stocGradAscent\
     目录           0  2018-07-13 15:00  Logistics_Regression\5.2_logRegres_stocGradAscent\__pycache__\
     文件        2290  2018-07-10 16:18  Logistics_Regression\5.2_logRegres_stocGradAscent\__pycache__\logRegres_stocGradAscent.cpython-36.pyc
     文件         455  2018-07-10 17:25  Logistics_Regression\5.2_logRegres_stocGradAscent\do_logRegres_stocGradAscent.py
     文件       15843  2018-07-10 17:25  Logistics_Regression\5.2_logRegres_stocGradAscent\LogRegres_StocGradAscent.eps
     文件        2178  2018-07-10 16:18  Logistics_Regression\5.2_logRegres_stocGradAscent\logRegres_stocGradAscent.py
     文件        2187  2010-10-29 06:46  Logistics_Regression\5.2_logRegres_stocGradAscent\testSet.txt
     目录           0  2018-07-13 15:00  Logistics_Regression\5.3_predict_the_death_rate_of_horse\
     目录           0  2018-07-13 15:00  Logistics_Regression\5.3_predict_the_death_rate_of_horse\__pycache__\
     文件        2185  2018-07-10 20:16  Logistics_Regression\5.3_predict_the_death_rate_of_horse\__pycache__\logRegres_stocGradAscent.cpython-36.pyc
     文件         203  2018-07-07 11:08  Logistics_Regression\5.3_predict_the_death_rate_of_horse\do_Prediction.py
     文件        3788  2010-11-01 15:09  Logistics_Regression\5.3_predict_the_death_rate_of_horse\horseColicTest.txt
     文件       60655  2010-11-01 14:56  Logistics_Regression\5.3_predict_the_death_rate_of_horse\horseColicTraining.txt
     文件        2196  2018-07-10 20:15  Logistics_Regression\5.3_predict_the_death_rate_of_horse\logRegres_stocGradAscent.py

评论

共有 条评论