Classifying the data with a normal Bayes classifier

We will then use the same procedure as in earlier chapters to train a normal Bayes classifier. Wait, why not a Naive Bayes classifier? Well, it turns out OpenCV doesn't really provide a true Naive Bayes classifier. Instead, it comes with a Bayesian classifier that doesn't necessarily expect features to be independent, but rather expects the data to be clustered into Gaussian blobs. This is exactly the kind of dataset we created earlier!

By following these steps, you will learn how to build a classifier with a normal Bayes classifier:

  1. We can create a new classifier using the following function:
In [5]: import cv2...     model_norm = cv2.ml.NormalBayesClassifier_create()
  1. Then, training is done ...

Get Machine Learning for OpenCV 4 - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.