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.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

(no description)

File Size: 319 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: DecisionStump  - X-Ref

__construct(int $columnIndex = self::AUTO_SELECT)   X-Ref
A DecisionStump classifier is a one-level deep DecisionTree. It is generally
used with ensemble algorithms as in the weak classifier role. <br>

If columnIndex is given, then the stump tries to produce a decision node
on this column, otherwise in cases given the value of -1, the stump itself
decides which column to take for the decision (Default DecisionTree behaviour)

__toString()   X-Ref
No description

setNumericalSplitCount(float $count)   X-Ref
While finding best split point for a numerical valued column,
DecisionStump looks for equally distanced values between minimum and maximum
values in the column. Given <i>$count</i> value determines how many split
points to be probed. The more split counts, the better performance but
worse processing time (Default value is 10.0)


trainBinary(array $samples, array $targets, array $labels)   X-Ref


getBestNumericalSplit(array $samples, array $targets, int $col)   X-Ref
Determines best split point for the given column


getBestNominalSplit(array $samples, array $targets, int $col)   X-Ref
No description

calculateErrorRate(array $targets, float $threshold, string $operator, array $values)   X-Ref
Calculates the ratio of wrong predictions based on the new threshold
value given as the parameter


predictProbability(array $sample, $label)   X-Ref
Returns the probability of the sample of belonging to the given label

Probability of a sample is calculated as the proportion of the label
within the labels of the training samples in the decision node

param: mixed $label

predictSampleBinary(array $sample)   X-Ref

return: mixed

resetBinary()   X-Ref
No description