python 数据科学

来源:互联网 发布:ubuntu输入法怎么用 编辑:程序博客网 时间:2024/05/19 13:07

资料:

PYTHON-进阶-ITERTOOLS模块小结

Python标准库——collections模块的Counter类

回归模型估测:


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