public RegressionModelPrediction predictRegression ( RowData data , double offset ) throws PredictException { double [ ] preds = preamble ( ModelCategory . Regression , data , offset ) ; RegressionModelPrediction p = new RegressionModelPrediction ( ) ; if ( enableLeafAssignment ) { // only get leaf node assignment if enabled SharedTreeMojoModel . LeafNodeAssignments assignments = leafNodeAssignmentExtended ( data ) ; p . leafNodeAssignments = assignments . _paths ; p . leafNodeAssignmentIds = assignments . _nodeIds ; } p . value = preds [ 0 ] ; if ( enableStagedProbabilities ) { double [ ] rawData = nanArray ( m . nfeatures ( ) ) ; rawData = fillRawData ( data , rawData ) ; p . stageProbabilities = ( ( SharedTreeMojoModel ) m ) . scoreStagedPredictions ( rawData , preds . length ) ; } if ( enableContributions ) { double [ ] rawData = nanArray ( m . nfeatures ( ) ) ; rawData = fillRawData ( data , rawData ) ; p . contributions = predictContributions . calculateContributions ( rawData ) ; } return p ; }
Make a prediction on a new data point using a Regression model .