码迷,mamicode.com
首页 > 其他好文 > 详细

第五篇[机器学习] 机器学习,逻辑回归come on

时间:2017-09-10 01:15:38      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:ges   alt   好的   算法   mode   targe   ati   这一   逻辑回归   

 

逻辑回归,简单的说,就是用sigmoid函数把连续函数归一化转化成离散的几个可能的结果。

逻辑回归的算法

最大似然法: 我自己的理解,最大似然法就是在你观测到某一系列事件出现的可能性之后,倒推该事件最可能的概率,这个最可能的概率会使这一系列事件发生的可能性无限接近我们观测到的可能性。

技术分享

技术分享

技术分享

技术分享

技术分享

 梯度下降法/随机梯度下降法

 推荐看这些文章:

http://www.jianshu.com/p/1121509ac1dc

http://blog.csdn.net/zouxy09/article/details/8537620

http://blog.csdn.net/hjl240/article/details/52402912

 在实际使用的时候,可以直接调用sklearn里面的LogisticRegression

 

from sklearn import cross_validation
from sklearn.linear_model import LogisticRegression  #逻辑回归
#Initialize our algorithm
alg=LogisticRegression(random_state=1)
#Compute the accuracy score for all the cross validation folds.(much simpler than what we did before!)
scores = cross_validation.cross_val_score(alg,titanic[predictors],titanic["Survived"],cv=3)
#Take the mean of the scores (because we have one for each fold)
print(scores.mean())

 概率明显提升。

 

看一下其他数据的使用。

 参考:http://blog.csdn.net/han_xiaoyang/article/details/49123419

最后总结:并不想总当搬运工,但是感觉人家都写的好好的,能让人看懂就好,以后慢慢自己再写一份,羞愧的低下了我的头。

 

第五篇[机器学习] 机器学习,逻辑回归come on

标签:ges   alt   好的   算法   mode   targe   ati   这一   逻辑回归   

原文地址:http://www.cnblogs.com/timotong/p/7487563.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!