SMILE.NET Learning: NaiveBayes
From DSL
This class implements a Naive Bayes learning algorithm.
[edit] Interfaces
- IDisposable
The .NET garbage collector automatically releases the memory allocated to objects when they are no longer used. It is, however, unpredictable when garbage collection will occur. Furthermore, the garbage collector has no knowledge of unmanaged resources such as the DSL_naiveBayes C++ object wrapped by NaiveBayes. The IDisposable.Dispose() method provides means to ensure that wrapped object is deleted before garbage collection occurs:
NaiveBayes nb = new NaiveBayes();
try {
// use nb here
}
finally {
if (nb != null) nb.Dispose();
}
C# has the using statement, which is equivalent to the try/finally/Dispose construct in the preceding example:
using (NaiveBayes nb = new NaiveBayes()) {
// use nb here
}
[edit] Properties
- string ClassVariableId (get, set)
Indicates the class variable (default = "class").
- bool FeatureSelection (get, set)
Determines if a feature selection algorithm should be used (default = false).
- double NetWeight (get, set)
For BDeu priors it defines the weight assigned to the uniform priors (default = 1.0).
- NaiveBayes.PriorsType PriorsMethod {NaiveBayes.PriorsType.K2, NaiveBayes.PriorsType.BDeu} (get, set)
Sets the priors method to use (default = K2).
[edit] Methods
- Network Learn(DataSet data)
Returns the learned Naive Bayes classifier. This method can throw a SmileException.
