我有以下线性回归器和决策树回归器的训练成绩。
lin_rmse_scores = np.array([65000.67382615, 70960.56056304, 67122.63935124, 66089.63153865,
68402.54686442, 65266.34735288, 65218.78174481, 68525.46981754,
72739.87555996, 68957.34111906])
tree_rmse_scores = np.array([65312.86044031, 70581.69865676, 67849.75809965, 71460.33789358,
74035.29744574, 65562.42978503, 67964.10942543, 69102.89388457,
66876.66473025, 69735.84760006])
我想用Pandas describe()来比较两个回归器的一些统计数据。对于线性回归器,我的操作如下。
df = pd.Series(lin_rmse_scores).describe()
在 "系列 "中,我想指定 "线性回归 "这一列。我想为决策树回归器添加第二列。结果应该是这样的。
'Lin Regr' 'Dec Tree'
count 10.000000 10.000000
mean 67828.386774 68848.189796
std 2601.596761 2719.219956
min 65000.673826 65312.860440
25% 65472.168399 67119.938073
50% 67762.593108 68533.501655
75% 68849.373294 70370.235893
max 72739.875560 74035.297446
让我们把它们组合在一起,然后再 describe
s=pd.DataFrame({'lin_rmse_scores':lin_rmse_scores,'tree_rmse_scores':tree_rmse_scores}).describe()
lin_rmse_scores tree_rmse_scores
count 10.000000 10.000000
mean 67828.386774 68848.189796
std 2601.596761 2719.219956
min 65000.673826 65312.860440
25% 65472.168399 67119.938073
50% 67762.593108 68533.501655
75% 68849.373294 70370.235893
max 72739.875560 74035.297446