python 数据科学 - 【回归分析】 ☞ 线性回归(2)
发布日期:2021-06-30 19:51:18 浏览次数:2 分类:技术文章

本文共 614 字,大约阅读时间需要 2 分钟。

资料:

回归模型估测:

import statsmodels.api as smX2 = sm.add_constant(X)est = sm.OLS(Y, X2)est2 = est.fit()print(est2.summary())

predictorcols = ['age', 'area', 'room', 'l_room', 'total_floor', '东南向', '东向','南北向', '南向', '西向', '中', '低']import itertoolsAICs = {}for k in range(1, len(predictorcols)+1):    for variables in itertools.combinations(predictorcols, k):        predictor1 = X[list(variables)]        predictor2 = sm.add_constant(predictor1)        est = sm.OLS(Y, predictor2)        res = est.fit()        AICs[variables] = res.aic
from collections import Counterc = Counter(AICs)c.most_common()[::-10]

比全部抛进去准确了 6W

转载地址:https://lipenglin.blog.csdn.net/article/details/78051104 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:python - 批量更改文件名(过滤掉某个字符串)
下一篇:python 数据科学 - 【回归分析】 ☞ 线性回归(1)

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年04月11日 15时39分59秒