Merge branch 'MDL-65175_master-fixup' of git://github.com/dmonllao/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2019-04-11 19:50:53 +02:00
commit a8ec611f57
2 changed files with 7 additions and 2 deletions

View File

@ -204,13 +204,14 @@ class models_list implements \renderable, \templatable {
$actionid = 'evaluate-' . $model->get_id();
$modeltimesplittingmethods = $timesplittingmethods;
// Include the current time-splitting method as the default selection method the model already have one.
if ($model->get_model_obj()->timesplitting) {
$currenttimesplitting = ['id' => 'current', 'text' => get_string('currenttimesplitting', 'tool_analytics')];
array_unshift($timesplittingmethods, $currenttimesplitting);
array_unshift($modeltimesplittingmethods, $currenttimesplitting);
}
$evaluateparams = [$actionid, $trainedonlyexternally, $timesplittingmethods];
$evaluateparams = [$actionid, $trainedonlyexternally, $modeltimesplittingmethods];
$PAGE->requires->js_call_amd('tool_analytics/model', 'selectEvaluationOptions', $evaluateparams);
$urlparams['action'] = 'evaluate';
$url = new \moodle_url('model.php', $urlparams);

View File

@ -291,11 +291,15 @@ class processor implements \core_analytics\classifier, \core_analytics\regressor
// We need at least 2 samples belonging to each target.
$counts = array_count_values($targets);
$ntargets = count(explode(',', $metadata['targetclasses']));
foreach ($counts as $count) {
if ($count < 2) {
$notenoughdata = true;
}
}
if ($ntargets > count($counts)) {
$notenoughdata = true;
}
if (!empty($notenoughdata)) {
$resultobj = new \stdClass();
$resultobj->status = \core_analytics\model::NOT_ENOUGH_DATA;