【发布时间】:2017-08-18 08:55:28
【问题描述】:
我有两个numpy数组如下
clf_scores = numpy.array(
[[ 0.66333666, 0.65634366, 0.63836164, 0.64435564, 0.658 ,
0.641 , 0.67167167, 0.66066066, 0.67167167, 0.65165165],
[ 0.6983017 , 0.70629371, 0.70529471, 0.68331668, 0.702 ,
0.688 , 0.71371371, 0.69269269, 0.70770771, 0.6996997 ],
[ 0.65934066, 0.68531469, 0.65834166, 0.66333666, 0.677 ,
0.668 , 0.68568569, 0.68668669, 0.6996997 , 0.68168168],
.... .... .... .... ....
[ 0.68731269, 0.71928072, 0.7002997 , 0.70929071, 0.723 ,
0.697 , 0.68968969, 0.71271271, 0.72672673, 0.6996997 ],
[ 0.68731269, 0.72027972, 0.6973027 , 0.70729271, 0.726 ,
0.695 , 0.68568569, 0.71271271, 0.72572573, 0.6996997 ],
[ 0.69030969, 0.71728272, 0.6983017 , 0.70929071, 0.725 ,
0.698 , 0.68668669, 0.71371371, 0.72572573, 0.6996997 ]])
和
Trees = numpy.array(
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100])
这些数组有形状 (100,10) 和 (100,)
如何使用 seaborn.boxplot 绘制这两个数组?
我尝试对这两个 numpy 数组进行箱线图,如下所示
sns.boxplot(clf_scores,Trees)
但是我得到以下错误
NotImplementedError: > 1 ndim Categorical are not supported at this time
请告诉我如何纠正它以获得适当的箱线图?
PS:数据集是通过RandomForestClassifier和nTrees = 100找到cross_val_score得到的
【问题讨论】:
-
这两个数组中的哪一个是
clf scores?我认为您应该编辑问题以使其更清楚。 -
@Peaceful 已更正!
标签: pandas numpy machine-learning scikit-learn seaborn