credulous.js
function Credulous(options) {
    var i
      ;
    if (!this) {
      return new Credulous(options);
    }

    options = validateOptions(options);

    this.labels = options.labels;
    this.dataLength = options.dataLength;
    // For the label
    this.trainArgumentsLength = this.dataLength + 1;

    // TODO: make the data store more modular
    this.dataStore = [];
    setUpDataStore(this.dataStore, this.labels, this.dataLength);
    this.instancesTrained = 0;
  }
function Credulous(options) {
    var i
      ;
    if (!this) {
      return new Credulous(options);
    }

    options = validateOptions(options);

    this.labels = options.labels;
    this.dataLength = options.dataLength;
    // For the label
    this.trainArgumentsLength = this.dataLength + 1;

    // TODO: make the data store more modular
    this.dataStore = [];
    setUpDataStore(this.dataStore, this.labels, this.dataLength);
    this.instancesTrained = 0;
  }
function Credulous ( options ) { var i ; if ( ! this ) { return new Credulous ( options ) ; } options = validateOptions ( options ) ; this . labels = options . labels ; this . dataLength = options . dataLength ; // For the label this . trainArgumentsLength = this . dataLength + 1 ; // TODO: make the data store more modular this . dataStore = [ ] ; setUpDataStore ( this . dataStore , this . labels , this . dataLength ) ; this . instancesTrained = 0 ; }
Constructor for the Naive Bayes learner.
It takes a list of strings, which represent the different
groups of strings to train on, followed by an array of possible
classes.

@param options: object of options that set up the naive bayes model.
It *must* have a `label` property that is an array of possible labels to assign
to things we are classifying.
It can optionally have a `dataLength` that specifies how many groups of strings
we are classifying. This is useful if we are classifying things that have several
separate attributes that we want to compute probabilities for separately. For
example, when calssifying an email, we might have three separate things to classify
on: the text of the email, the text of the subject, and the country of origin in
the sender's address. In this case, we would set `dataLength` to 3, and pass these
in as three separate arguments to the `train()` method.
Constructor for the Naive Bayes learner . It takes a list of strings which represent the different groups of strings to train on followed by an array of possible classes .