Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
69b68ad6
Commit
69b68ad6
authored
Apr 11, 2019
by
David Monllaó
Browse files
MDL-65175 mlbackend_php: Add missing checking for number of targets
parent
d5111e6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/mlbackend/php/classes/processor.php
View file @
69b68ad6
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment