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!
We can create a new classifier using the following function:
In [5]: import cv2... model_norm = cv2.ml.NormalBayesClassifier_create()
Then, training is done via the train method:
In [6]: model_norm.train(X_train, cv2.ml.ROW_SAMPLE, y_train)Out[6]: True ...