.. index:: single: naive_bayes .. _naive_bayes/0: .. rst-class:: right **object** ``naive_bayes`` =============== Naive Bayes classifier with Laplace smoothing and Gaussian distribution support. Learns from a dataset object implementing the ``dataset_protocol`` protocol and returns a classifier term that can be used for prediction and exported as predicate clauses. | **Availability:** | ``logtalk_load(naive_bayes(loader))`` | **Author:** Paulo Moura | **Version:** 1:0:0 | **Date:** 2026-02-20 | **Compilation flags:** | ``static, context_switching_calls`` | **Implements:** | ``public`` :ref:`classifier_protocol ` | **Uses:** | :ref:`format ` | :ref:`list ` | :ref:`pairs ` | :ref:`population ` | **Remarks:** - Algorithm: Naive Bayes is a probabilistic classifier based on Bayes theorem with strong (naive) independence assumptions between features. - Categorical features: Uses Laplace smoothing to handle unseen feature values. - Continuous features: Uses Gaussian (normal) distribution to model numeric features. - Classifier representation: The learned classifier is represented by default as ``nb_classifier(Classes, ClassPriors, AttributeNames, FeatureTypes, FeatureParams)`` where ``FeatureParams`` contains the learned probabilities or statistics for each feature. | **Inherited public predicates:** |  :ref:`classifier_protocol/0::classifier_to_clauses/4`  :ref:`classifier_protocol/0::classifier_to_file/4`  :ref:`classifier_protocol/0::learn/2`  :ref:`classifier_protocol/0::predict/3`  :ref:`classifier_protocol/0::print_classifier/1`   .. contents:: :local: :backlinks: top Public predicates ----------------- .. index:: predict_probabilities/3 .. _naive_bayes/0::predict_probabilities/3: ``predict_probabilities/3`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Predicts class probabilities for a new instance using the learned classifier. Returns a list of ``Class-Probability`` pairs. The instance is a list of ``Attribute-Value`` pairs. | **Compilation flags:** | ``static`` | **Template:** | ``predict_probabilities(Classifier,Instance,Probabilities)`` | **Mode and number of proofs:** | ``predict_probabilities(+compound,+list,-list)`` - ``one`` ------------ Protected predicates -------------------- (no local declarations; see entity ancestors if any) Private predicates ------------------ (no local declarations; see entity ancestors if any) Operators --------- (none) .. seealso:: :ref:`dataset_protocol `, :ref:`isolation_forest `, :ref:`c45 `, :ref:`knn `, :ref:`nearest_centroid `, :ref:`random_forest `, :ref:`ada_boost `