Class NaiveBayesClassifierMapLaplacedImpl

  • All Implemented Interfaces:
    INaiveBayesClassifier

    public class NaiveBayesClassifierMapLaplacedImpl
    extends AbstractNaiveBayesClassifierMapImpl
    implements INaiveBayesClassifier
    Naive Bayes Classifier with Laplace smoothing and implementation with concurrent ConcurrentHashMap or persistent mapDB. The Laplace smoothing has two variants as per Sample1 and Sample2.
    Author:
    elian carsenat, NamSor SAS
    • Constructor Detail

      • NaiveBayesClassifierMapLaplacedImpl

        public NaiveBayesClassifierMapLaplacedImpl​(String classifierName,
                                                   String[] categories)
        Create in-memory classifier using ConcurrentHashMap and defaults for Laplace smoothing (ALPHA=1 and VARIANT=false)
        Parameters:
        classifierName - The classifier name
        categories - The classification categories
      • NaiveBayesClassifierMapLaplacedImpl

        public NaiveBayesClassifierMapLaplacedImpl​(String classifierName,
                                                   String[] categories,
                                                   double alpha,
                                                   boolean variant)
        Create a classifier with in-memory ConcurrentHashMap and Laplace parameters
        Parameters:
        classifierName - The classifier name
        categories - The classification categories
        alpha - The Laplace alpha, typically 1.0
        variant - The Laplace variant
      • NaiveBayesClassifierMapLaplacedImpl

        public NaiveBayesClassifierMapLaplacedImpl​(String classifierName,
                                                   String[] categories,
                                                   double alpha,
                                                   boolean variant,
                                                   String rootPathWritable)
        Create persistent classifier using org.mapdb.HTreeMap and Laplace parameters
        Parameters:
        classifierName - The classifier name
        categories - The classification categories
        alpha - The Laplace alpha, typically 1.0
        variant - The Laplace variant
        rootPathWritable - A writable directory for org.mapdb.HTreeMap storage
      • NaiveBayesClassifierMapLaplacedImpl

        public NaiveBayesClassifierMapLaplacedImpl​(String classifierName,
                                                   String[] categories,
                                                   String rootPathWritable)
        Create persistent classifier using org.mapdb.HTreeMap and defaults for Laplace smoothing (ALPHA=1 and VARIANT=false)
        Parameters:
        classifierName - The classifier name
        categories - The classification categories
        rootPathWritable - A writable directory for org.mapdb.HTreeMap storage