我正在尝试在我的随机森林代码中测量 MAPE(平均绝对百分比误差)值。MAE 值为 7.5。当我尝试计算 MAPE 时,它输出:
Accuracy: -inf %
这是我计算 MAPE 的代码。如何使其工作或为什么不计算值。
mape = 100 * (errors / test_labels)
# Calculate and display accuracy
accuracy = 100 - np.mean(mape)
print('Accuracy:', round(accuracy, 2), '%.')
以下是值:
errors: array([ 2.165, 6.398, 2.814, ..., 21.268, 8.746, 11.63 ])
test_labels: array([45, 47, 98, ..., 87, 47, 72])
这些是类型:
var1 int64
var2 int64
var3 float64
var4 int64
var6 float64
var7 int64
var1. float64
dtype: object
示例值,超过 8000 个条目
var1 var2. var3 var4 var5 var6 var7
"420823370" "183" "2019-09-07 22:13:04" "84" "2019-09-07 22:12:46" "72" "00:00:18"
"420521201" "183" "2019-09-07 17:43:03" "84" "2019-09-07 17:42:51" "46" "00:00:12"
"420219554" "183" "2019-09-07 12:43:02" "88" "2019-09-07 12:42:39" "72" "00:00:23"
"419618820" "183" "2019-09-07 02:43:01" "92" "2019-09-07 02:42:46" "80" "00:00:15"
"419618819" "183" "2019-09-07 02:43:01" "84" "2019-09-07 02:42:46" "80" "00:00:15"
"417193989" "183" "2019-09-05 10:42:52" "82" "2019-09-05 10:42:23" "0" "00:00:29"
"416891691" "183" "2019-09-05 05:42:51" "78" "2019-09-05 05:42:49" "72" "00:00:02"
"416587222" "183" "2019-09-05 00:42:51" "88" "2019-09-05 00:42:35" "99" "00:00:16"
"416587223" "183" "2019-09-05 00:42:51" "82" "2019-09-05 00:42:35" "99" "00:00:16"
"416587224" "183" "2019-09-05 00:42:51" "80" "2019-09-05 00:42:35" "99" "00:00:16"
id:Big Int. ts_tuid: Big Int. rssi: numeric. batl: real. ts_diff:interval
绝地无双
手掌心
相关分类