Skip to content

Commit

Permalink
MDL-59657 analytics: No predictions until training is completed
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonllao authored and David Monllao committed Sep 7, 2017
1 parent 2999602 commit ce99f1f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions admin/tool/analytics/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@

// Looks dumb to get a new instance but better be conservative.
$model = new \core_analytics\model($model->get_model_obj());
$predictresults = $model->predict();
$predictlogs = $model->get_analyser()->get_logs();
if ($model->is_trained()) {
$predictresults = $model->predict();
$predictlogs = $model->get_analyser()->get_logs();
} else {
$predictresults = false;
$predictlogs = array();
}

$renderer = $PAGE->get_renderer('tool_analytics');
echo $renderer->render_get_predictions_results($trainresults, $trainlogs, $predictresults, $predictlogs);
Expand Down

0 comments on commit ce99f1f

Please sign in to comment.