public MultinomialModelPrediction predictMultinomial ( RowData data , double offset ) throws PredictException { double [ ] preds = preamble ( ModelCategory . Multinomial , data , offset ) ; MultinomialModelPrediction p = new MultinomialModelPrediction ( ) ; if ( enableLeafAssignment ) { // only get leaf node assignment if enabled SharedTreeMojoModel . LeafNodeAssignments assignments = leafNodeAssignmentExtended ( data ) ; p . leafNodeAssignments = assignments . _paths ; p . leafNodeAssignmentIds = assignments . _nodeIds ; } p . classProbabilities = new double [ m . getNumResponseClasses ( ) ] ; p . labelIndex = ( int ) preds [ 0 ] ; String [ ] domainValues = m . getDomainValues ( m . getResponseIdx ( ) ) ; p . label = domainValues [ p . labelIndex ] ; System . arraycopy ( preds , 1 , p . classProbabilities , 0 , p . classProbabilities . length ) ; if ( enableStagedProbabilities ) { double [ ] rawData = nanArray ( m . nfeatures ( ) ) ; rawData = fillRawData ( data , rawData ) ; p . stageProbabilities = ( ( SharedTreeMojoModel ) m ) . scoreStagedPredictions ( rawData , preds . length ) ; } return p ; }
Make a prediction on a new data point using a Multinomial model .