From d6845d807e541a7ad68118490c20a701a5137a0d Mon Sep 17 00:00:00 2001 From: Igor Date: Wed, 11 Apr 2018 21:53:48 +0300 Subject: [PATCH] Fix error when calling nb.Predict() nb.Predict retruns two variables, the other being error. This example won't compile if error is not handled. --- Chapter05/naive_bayes/example1/myprogram.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Chapter05/naive_bayes/example1/myprogram.go b/Chapter05/naive_bayes/example1/myprogram.go index 27f4806..9b57f5e 100644 --- a/Chapter05/naive_bayes/example1/myprogram.go +++ b/Chapter05/naive_bayes/example1/myprogram.go @@ -31,7 +31,10 @@ func main() { } // Make our predictions. - predictions := nb.Predict(convertToBinary(testData)) + predictions, err := nb.Predict(convertToBinary(testData)) + if err != nil { + log.Fatal(err) + } // Generate a Confusion Matrix. cm, err := evaluation.GetConfusionMatrix(testData, predictions)