statsmodels

statsmodelsを使うと、線形重回帰でAICを求めることができる。他にもいろいろできそうだが、未調査。
例は以下の通り
import numpy as npimport statsmodels.api as sm
tsz=10xsz=5x=np.random.randn(tsz,xsz)y=np.mean(x[:,:2],axis=1)+np.random.randn(tsz)x=sm.add_constant(x)
model = sm.OLS(y, x).fit() #OLS は ordinary least squares print(model.aic)
x2=x[:,:4]model2 = sm.OLS(y, x2).fit()print(model2.aic)