首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用curve_fit规范线性回归?

如何用curve_fit规范线性回归?
EN

Stack Overflow用户
提问于 2013-12-27 15:20:43
回答 1查看 1.3K关注 0票数 4

最近,我已经熟练地使用Python/scipy curve_fit来执行线性回归。然而,对于高阶多项式,我的数据有时是过拟合的。

如何增加正则化以减少过度拟合?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-27 15:55:35

我想知道套索惩罚是否适合你:

代码语言:javascript
复制
# the high order items can be integrated into X (such as x1^2,x1*x2), and change it into a linear regression problem again
lasso.fit(X, y) 
# the selection range of lambda can be determined by yourself.
LassoCV(lambda=array([ 2, 1,9, ..., 0.2 , 0.1]),  
copy_X=True, cv=None, eps=0.001, fit_intercept=True, max_iter=1000,
n_alphas=100, normalize=False, precompute=’auto’, tol=0.0001,
verbose=False)

在交叉验证过程中应该选择最优的lambda。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20803090

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档