Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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?

param: mixed $class
return: bool

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

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

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

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

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.

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