From 86e2c5aa61d6b9635fdb03b402aec9938af31ab7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 16 May 2019 21:22:55 -0400 Subject: [PATCH] Fix incorrect shapes for accuracy computation. --- doc/guide/python_quickstart.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/guide/python_quickstart.hpp b/doc/guide/python_quickstart.hpp index fd8bfca4a6..3298c0aee6 100644 --- a/doc/guide/python_quickstart.hpp +++ b/doc/guide/python_quickstart.hpp @@ -99,7 +99,8 @@ output = mlpack.random_forest(input_model=random_forest, # Now print the accuracy. The 'probabilities' output could also be used # to generate an ROC curve. -correct = np.sum(output['predictions'] == test_labels) +correct = np.sum( + output['predictions'] == np.reshape(test_labels, (test_labels.shape[0],))) print(str(correct) + ' correct out of ' + str(len(test_labels)) + ' (' + str(100 * float(correct) / float(len(test_labels))) + '%).') @endcode