我正在尝试实现一个预测模块,其中我将预测存储在一个数据帧中
pred = pd.DataFrame(index=range(0,len(prediction)),columns=[cols])
for j in range(0,5):
for i in range(0, len(prediction)):
pred.iloc[i][j] = prediction[i][j]
如果我将列作为类型,我将得到:
pred.columns.astype
bound method MultiIndex.astype of MultiIndex([( 'Total_Searches',),
( 'Total_Bookings',),
('Capacity_booked',),
( 'numBookings_2',),
( '%Variation-2',)],
)
现在,我想通过检查训练集来检查MSE值,我得到以下结果:
#check rmse
for i in cols:
print('rmse value for', i, 'is : ', sqrt(mean_squared_error(pred[i], valid[i])))
我得到以下错误:TypeError:只有整数标量数组才能转换为标量索引
valid的类型如下所示:
valid.columns.astype
Out[1226]:
bound method Index.astype of Index(['Total_Searches', 'Total_Bookings', 'Capacity_booked', 'numBookings_2',
'%Variation-2'],
dtype='object')
有人能告诉我这里出了什么问题吗
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐