NormalBayesClassifier

Objective-C

@interface NormalBayesClassifier : StatModel

Swift

class NormalBayesClassifier : StatModel

Bayes classifier for normally distributed data.

See

REF: ml_intro_bayes

Member of Ml

Methods

  • Creates empty model Use StatModel::train to train the model after creation.

    Declaration

    Objective-C

    + (nonnull NormalBayesClassifier *)create;

    Swift

    class func create() -> NormalBayesClassifier
  • Loads and creates a serialized NormalBayesClassifier from a file

    Use NormalBayesClassifier::save to serialize and store an NormalBayesClassifier to disk. Load the NormalBayesClassifier from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

    Declaration

    Objective-C

    + (nonnull NormalBayesClassifier *)load:(nonnull NSString *)filepath
                                   nodeName:(nonnull NSString *)nodeName;

    Swift

    class func load(filepath: String, nodeName: String) -> NormalBayesClassifier

    Parameters

    filepath

    path to serialized NormalBayesClassifier

    nodeName

    name of node containing the classifier

  • Loads and creates a serialized NormalBayesClassifier from a file

    Use NormalBayesClassifier::save to serialize and store an NormalBayesClassifier to disk. Load the NormalBayesClassifier from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

    Declaration

    Objective-C

    + (nonnull NormalBayesClassifier *)load:(nonnull NSString *)filepath;

    Swift

    class func load(filepath: String) -> NormalBayesClassifier

    Parameters

    filepath

    path to serialized NormalBayesClassifier

  • Predicts the response for sample(s).

     The method estimates the most probable classes for input vectors. Input vectors (one or more)
     are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one
     output vector outputs. The predicted class for a single input vector is returned by the method.
     The vector outputProbs contains the output probabilities corresponding to each element of
     result.
    

    Declaration

    Objective-C

    - (float)predictProb:(nonnull Mat *)inputs
                 outputs:(nonnull Mat *)outputs
             outputProbs:(nonnull Mat *)outputProbs
                   flags:(int)flags;

    Swift

    func predictProb(inputs: Mat, outputs: Mat, outputProbs: Mat, flags: Int32) -> Float
  • Predicts the response for sample(s).

     The method estimates the most probable classes for input vectors. Input vectors (one or more)
     are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one
     output vector outputs. The predicted class for a single input vector is returned by the method.
     The vector outputProbs contains the output probabilities corresponding to each element of
     result.
    

    Declaration

    Objective-C

    - (float)predictProb:(nonnull Mat *)inputs
                 outputs:(nonnull Mat *)outputs
             outputProbs:(nonnull Mat *)outputProbs;

    Swift

    func predictProb(inputs: Mat, outputs: Mat, outputProbs: Mat) -> Float