variables = df.iloc[:,:13]
results = df1.iloc[:,14:]
regression = linear_model.LinearRegression()
regression.fit(variables,results)
print(variables.shape,results.shape)
input_values = [2,2]
prediction = regression.predict([input_values])
prediction = [round(x,2) for x in prediction[0]]
print(prediction)
错误为ValueError:matmul:Input操作数1的核心维度0与gufunc签名(n?,k)、(k,m?)不匹配->;(n?,m?)(13号与2号不同)。 变量的形状是(51,13)(51,11)
这是多元输出回归,当我做预测部分时,存在一个误差。但我不知道怎么修,请帮帮我
问题是,您的输入中有13个特征,但在预测部分,您只传递了2个值。必须传递一个维度数组(x,13),其中x属于某个自然数。如果它解决了你的问题,那么请给绿色的勾号并投上一票
相关问题 更多 >
编程相关推荐