问题描述
我正在尝试使用5个代理进行PLS回归。
date pdnd cefd ripo nipo s
0 1965-07-31 31.123778 19.274681 6.244944 10.333333 0.153472
1 1965-08-31 30.705603 19.479926 5.968817 10.083333 0.137691
2 1965-09-30 30.157715 18.845566 5.289247 10.833333 0.138454
3 1965-10-31 30.120378 17.532712 5.667742 11.083333 0.137525
4 1965-11-30 30.396602 16.818206 5.719355 12.083333 0.125939
5 1965-12-31 30.573540 16.331693 4.922680 12.166667 0.116760
6 1966-01-31 30.276061 15.787432 4.932258 12.083333 0.125947
代码:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import scale
from sklearn import model_selection
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression
from sklearn.cross_decomposition import PLSRegression,PLSSVD
from sklearn.metrics import mean_squared_error
pdnd=data.loc[:,'pdnd']
cefd=data.loc[:,'cefd']
ripo=data.loc[:,'ripo']
nipo=data.loc[:,'nipo']
s=data.loc[:,'s']
pls2 = PLSRegression(n_components = 5)
pls2.fit(pdnd,cefd,ripo,nipo,s)
但输出是
TypeError: fit() takes 3 positional arguments but 6 were given
所以我很好奇如何包含所有代理并得出答案?
预先感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)