Naïve Bayes learning algorithm for discrete distribution models.
Inheritance Hierarchy Namespace: Accord.MachineLearning.BayesAccord.MachineLearning (in Accord.MachineLearning.dll) Version: 3.8.0
Syntax[SerializableAttribute] public class NaiveBayesLearning : NaiveBayesLearningBase<NaiveBayes, GeneralDiscreteDistribution, int, IndependentOptions<GeneralDiscreteOptions>, GeneralDiscreteOptions>, ISupervisedLearning<NaiveBayes, int[], double[]>, ISupervisedLearning<NaiveBayes, int[], int>
<SerializableAttribute> Public Class NaiveBayesLearning Inherits NaiveBayesLearningBase(Of NaiveBayes, GeneralDiscreteDistribution, Integer, IndependentOptions(Of GeneralDiscreteOptions), GeneralDiscreteOptions) Implements ISupervisedLearning(Of NaiveBayes, Integer(), Double()), ISupervisedLearning(Of NaiveBayes, Integer(), Integer)Request Example View Source
The NaiveBayesLearning type exposes the following members.
Constructors Properties Name Description DistributionGets or sets the distribution creation function. This function can be used to specify how the initial distributions of the model should be created. By default, this function attempts to call the empty constructor of the distribution using Activator.CreateInstance().
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) EmpiricalGets or sets whether the class priors should be estimated from the data.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) ModelGets or sets the model being learned.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) OptionsGets or sets the fitting options to use when estimating the class-specific distributions.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) ParallelOptionsGets or sets the parallelization options for this algorithm.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) TokenGets or sets a cancellation token that can be used to stop the learning algorithm while it is running.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) Top Methods Name Description CreateCreates an instance of the model to be learned.
(Overrides NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptionsCreate(TInput, Int32).) EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object.) FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.) FitFits one of the distributions in the naive bayes model.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions, TInnerOptions.) GetHashCodeServes as the default hash function.
(Inherited from Object.) GetTypeGets the Type of the current instance.
(Inherited from Object.) Learn(TInput, Double, Double)Learns a model that can map the given inputs to the given outputs.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) Learn(TInput, Int32, Double)Learns a model that can map the given inputs to the given outputs.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) Learn(TInput, Int32, Double)Learns a model that can map the given inputs to the given outputs.
(Inherited from NaiveBayesLearningBaseTModel, TDistribution, TInput, TOptions.) MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object.) ToStringReturns a string that represents the current object.
(Inherited from Object.) Top Extension Methods Name Description HasMethodChecks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) IsEqualCompares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.) To(Type) Overloaded.Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) ToT Overloaded.Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) Top ExamplesFor basic examples on how to learn a Naive Bayes algorithm, please see NaiveBayes page. The following examples show how to set more specialized learning settings for discrete models.
int[][] inputs = { new [] { 0, 1 }, new [] { 0, 2 }, new [] { 0, 1 }, new [] { 1, 2 }, new [] { 0, 2 }, new [] { 0, 2 }, new [] { 1, 1 }, new [] { 0, 1 }, new [] { 1, 1 }, }; int[] outputs = { 0, 0, 0, 1, 1, 1, 2, 2, 2, }; var bayes = new NaiveBayes(classes: 3, symbols: new[] { 2, 3 }); var learning = new NaiveBayesLearning() { Model = bayes }; learning.Options.InnerOption.UseLaplaceRule = true; learning.Learn(inputs, outputs); int answer = bayes.Decide(new int[] { 0, 1 });See Also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4