private function format_predictor_predictions($predictorresult) {

        $predictions = array();
        if (!empty($predictorresult->predictions)) {
            foreach ($predictorresult->predictions as $sampleinfo) {

                // We parse each prediction.
                switch (count($sampleinfo)) {
                    case 1:
                        // For whatever reason the predictions processor could not process this sample, we
                        // skip it and do nothing with it.
                        debugging($this->model->id . ' model predictions processor could not process the sample with id ' .
                            $sampleinfo[0], DEBUG_DEVELOPER);
                        continue 2;
                    case 2:
                        // Prediction processors that do not return a prediction score will have the maximum prediction
                        // score.
                        list($uniquesampleid, $prediction) = $sampleinfo;
                        $predictionscore = 1;
                        break;
                    case 3:
                        list($uniquesampleid, $prediction, $predictionscore) = $sampleinfo;
                        break;
                    default:
                        break;
                }
                $predictiondata = (object)['prediction' => $prediction, 'predictionscore' => $predictionscore];
                $predictions[$uniquesampleid] = $predictiondata;
            }
        }
        return $predictions;
    }