Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 403]

(no description)

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

Defines 1 class

Bagging:: (8 methods):
  __construct()
  setSubsetRatio()
  setClassifer()
  train()
  getRandomSubset()
  initClassifiers()
  initSingleClassifier()
  predictSample()


Class: Bagging  - X-Ref

__construct(int $numClassifier = 50)   X-Ref
Creates an ensemble classifier with given number of base classifiers
Default number of base classifiers is 50.
The more number of base classifiers, the better performance but at the cost of procesing time


setSubsetRatio(float $ratio)   X-Ref
This method determines the ratio of samples used to create the 'bootstrap' subset,
e.g., random samples drawn from the original dataset with replacement (allow repeats),
to train each base classifier.

return: $this

setClassifer(string $classifier, array $classifierOptions = [])   X-Ref
This method is used to set the base classifier. Default value is
DecisionTree::class, but any class that implements the <i>Classifier</i>
can be used. <br>
While giving the parameters of the classifier, the values should be
given in the order they are in the constructor of the classifier and parameter
names are neglected.

return: $this

train(array $samples, array $targets)   X-Ref
No description

getRandomSubset(int $index)   X-Ref
No description

initClassifiers()   X-Ref
No description

initSingleClassifier(Classifier $classifier)   X-Ref
No description

predictSample(array $sample)   X-Ref

return: mixed