众所周知,在logistic回归算法中,当θ乘以X大于0.5时,我们就可以预测一个。我想提高精度值。所以我想改变预测函数,当θ乘以X大于0.7或其他值大于0.5时,预测1。在
如果我写算法,我可以很容易地做到。但是对于sklearn包,我不知道该怎么做。在
有人能帮我吗?在
为了更清楚地解释这个问题,下面是以八度为单位的预测函数wroten:
p = sigmoid(X*theta);
for i=1:size(p)(1)
if p(i) >= 0.6
p(i) = 1;
else
p(i) = 0;
endif;
endfor
Tags:
sklearn的
LogisticRegression
预测器对象有一个predict_proba
方法,它输出输入示例属于某个类的概率。你可以使用这个函数和你自己定义的θ乘以X来获得你想要的功能。在例如:
这是
^{pr2}$predict_proba
的docstring:这适用于二进制和多类分类:
相关问题 更多 >
编程相关推荐