dist/multilabel/MetaLabeler.js
function(sample, explain) {
		var rankedLabelsWithExplain = this.ranker.classify(sample, explain, /*withScores=*/true);
		var rankedLabels = (explain>0? rankedLabelsWithExplain.classes: rankedLabelsWithExplain);
		var labelCountWithExplain = this.counter.classify(sample, explain, /*withScores=*/true);
		var labelCount = (explain>0? labelCountWithExplain.classes[0][0]: labelCountWithExplain[0][0]);
		if (_.isString(labelCount)) labelCount = parseInt(labelCount);
		
		// Pick the labelCount most relevant labels from the list returned by the ranker:   
		var positiveLabelsWithScores = rankedLabels.slice(0, labelCount);

		var positiveLabels = positiveLabelsWithScores

		if (positiveLabelsWithScores.length != 0)
			if (_.isArray(positiveLabelsWithScores[0]))
				var positiveLabels = positiveLabelsWithScores.map(function(labelWithScore) {return labelWithScore[0]});
		
		return (explain>0? {
			classes: positiveLabels,
			explanation: {
				ranking: rankedLabelsWithExplain.explanation,
				counting: labelCountWithExplain.explanation
			}
		}:
		positiveLabels)
	}
function(sample, explain) {
		var rankedLabelsWithExplain = this.ranker.classify(sample, explain, /*withScores=*/true);
		var rankedLabels = (explain>0? rankedLabelsWithExplain.classes: rankedLabelsWithExplain);
		var labelCountWithExplain = this.counter.classify(sample, explain, /*withScores=*/true);
		var labelCount = (explain>0? labelCountWithExplain.classes[0][0]: labelCountWithExplain[0][0]);
		if (_.isString(labelCount)) labelCount = parseInt(labelCount);
		
		// Pick the labelCount most relevant labels from the list returned by the ranker:   
		var positiveLabelsWithScores = rankedLabels.slice(0, labelCount);

		var positiveLabels = positiveLabelsWithScores

		if (positiveLabelsWithScores.length != 0)
			if (_.isArray(positiveLabelsWithScores[0]))
				var positiveLabels = positiveLabelsWithScores.map(function(labelWithScore) {return labelWithScore[0]});
		
		return (explain>0? {
			classes: positiveLabels,
			explanation: {
				ranking: rankedLabelsWithExplain.explanation,
				counting: labelCountWithExplain.explanation
			}
		}:
		positiveLabels)
	}
function ( sample , explain ) { var rankedLabelsWithExplain = this . ranker . classify ( sample , explain , /*withScores=*/ true ) ; var rankedLabels = ( explain > 0 ? rankedLabelsWithExplain . classes : rankedLabelsWithExplain ) ; var labelCountWithExplain = this . counter . classify ( sample , explain , /*withScores=*/ true ) ; var labelCount = ( explain > 0 ? labelCountWithExplain . classes [ 0 ] [ 0 ] : labelCountWithExplain [ 0 ] [ 0 ] ) ; if ( _ . isString ( labelCount ) ) labelCount = parseInt ( labelCount ) ; // Pick the labelCount most relevant labels from the list returned by the ranker:    var positiveLabelsWithScores = rankedLabels . slice ( 0 , labelCount ) ; var positiveLabels = positiveLabelsWithScores if ( positiveLabelsWithScores . length != 0 ) if ( _ . isArray ( positiveLabelsWithScores [ 0 ] ) ) var positiveLabels = positiveLabelsWithScores . map ( function ( labelWithScore ) { return labelWithScore [ 0 ] } ) ; return ( explain > 0 ? { classes : positiveLabels , explanation : { ranking : rankedLabelsWithExplain . explanation , counting : labelCountWithExplain . explanation } } : positiveLabels ) }
Use the model trained so far to classify a new sample.

@param sample a document.
@param explain - int - if positive, an "explanation" field, with the given length, will be added to the result.

@return an array whose VALUES are classes.
Use the model trained so far to classify a new sample .