nl_tokens: Train the classifier with all the given documents .
pl_tokens: function ( dataset ) { // this variable will hold a dataset for each binary classifier: var mapClassnameToDataset = { } ; // create positive samples for each class: for ( var d in dataset ) { var sample = dataset [ d ] . input ; dataset [ d ] . output = multilabelutils . normalizeOutputLabels ( dataset [ d ] . output ) ; var labels = dataset [ d ] . output ; for ( var l in labels ) { var positiveLabel = labels [ l ] ; this . makeSureClassifierExists ( positiveLabel ) ; if ( ! ( positiveLabel in mapClassnameToDataset ) ) // make sure dataset for this class exists mapClassnameToDataset [ positiveLabel ] = [ ] ; mapClassnameToDataset [ positiveLabel ] . push ( { input : sample , output : 1 } ) } } // create negative samples for each class (after all labels are in the array): for ( var d in dataset ) { var sample = dataset [ d ] . input ; var labels = dataset [ d ] . output ; for ( var negativeLabel in this . mapClassnameToClassifier ) { if ( ! ( negativeLabel in mapClassnameToDataset ) ) // make sure dataset for this class exists mapClassnameToDataset [ negativeLabel ] = [ ] ; if ( labels . indexOf ( negativeLabel ) < 0 ) mapClassnameToDataset [ negativeLabel ] . push ( { input : sample , <mask> : 0 } ) ; } } // train all classifiers: for ( var label in mapClassnameToDataset ) { if ( this . debug ) console . dir ( "TRAIN class=" + label ) ; this . mapClassnameToClassifier [ label ] . trainBatch ( mapClassnameToDataset [ label ] ) ; } }