public ClusteringModelPrediction predictClustering ( RowData data ) throws PredictException { ClusteringModelPrediction p = new ClusteringModelPrediction ( ) ; if ( useExtendedOutput && ( m instanceof IClusteringModel ) ) { IClusteringModel cm = ( IClusteringModel ) m ; // setup raw input double [ ] rawData = nanArray ( m . nfeatures ( ) ) ; rawData = fillRawData ( data , rawData ) ; // get cluster assignment & distances final int k = cm . getNumClusters ( ) ; p . distances = new double [ k ] ; p . cluster = cm . distances ( rawData , p . distances ) ; } else { double [ ] preds = preamble ( ModelCategory . Clustering , data ) ; p . cluster = ( int ) preds [ 0 ] ; } return p ; }
Make a prediction on a new data point using a Clustering model .