首页 > 其他 > 详细

UFLDL课程学习(二)

时间:2015-04-23 14:58:40      阅读:143      评论:0      收藏:0      [点我收藏+]

章节地址:http://ufldl.stanford.edu/tutorial/supervised/LogisticRegression/

章节名称:逻辑回归 (Logisitic Regression)

第二章的主要问题是什么?是内存不够,艹

Error using fread
Out of memory. Type HELP MEMORY for your options.

说明一下,其实都是我的错,我的电脑是32位机


因为机子的关系,所以这里只是意淫一下结果,并做一下分析

对于逻辑回归中的能量函数J(),如下:

技术分享

首先,函数h(x)的范围是(0,1),所以log(h(x))的范围是(负无穷,0),所以原文中说 当y=1时,目标是让log(h(x))尽量大是正确的,因为最大值是0。(When y(i)=1 minimizing the cost function means we need to make hθ(x(i)) large)


下面是代码,效果由于我不能运行,之后再贴吧:

%%% YOUR CODE HERE %%%
%   h = sigmoid(theta*X);
%   f = -y*log2(h)+(1-y)*log2(1-h);
%   g = (h-y)*X;
  h = sigmoid(X*theta);  
  f=-y*log2(h)+(1-y)*log2(1-h);  
  g=X*(h-y);

 

UFLDL课程学习(二)

原文:http://www.cnblogs.com/william7neral/p/4450283.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!