Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Discrete values target.

Copyright: 2017 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 176 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: discrete  - X-Ref

Discrete values target.

is_linear()   X-Ref
Are this target calculations linear values?

return: bool

is_a_class($class)   X-Ref
Is the provided class one of this target valid classes?

return: bool
param: mixed $class

get_display_value($value, $ignoredsubtype = false)   X-Ref
get_display_value

return: string
param: float $value
param: string $ignoredsubtype

get_calculation_outcome($value, $ignoredsubtype = false)   X-Ref
get_calculation_outcome

return: int
param: float $value
param: string $ignoredsubtype

get_classes()   X-Ref
Returns all the possible values the target calculation can return.

Only useful for targets using discrete values, must be overwriten if it is the case.

return: array

classes_description()   X-Ref
Returns descriptions for each of the values the target calculation can return.

The array indexes should match self::get_classes indexes.

return: array

ignored_predicted_classes()   X-Ref
Returns the predicted classes that will be ignored.

Better be keen to add more than less classes here, the callback is always able to discard some classes. As an example
a target with classes 'grade 0-3', 'grade 3-6', 'grade 6-8' and 'grade 8-10' is interested in flagging both 'grade 6-8'
and 'grade 8-10' as ignored. On the other hand, a target like dropout risk with classes 'yes', 'no' may just be
interested in 'yes'.

return: array List of values that will be ignored (array keys are ignored).

triggers_callback($predictedvalue, $predictionscore)   X-Ref
This method determines if a prediction is interesing for the model or not.

This method internally calls ignored_predicted_classes to skip classes
flagged by the target as not important for users.

return: bool
param: mixed $predictedvalue
param: float $predictionscore