1 | <?php |
||
12 | class RandomForest extends Bagging |
||
13 | { |
||
14 | /** |
||
15 | * @var float|string |
||
16 | */ |
||
17 | protected $featureSubsetRatio = 'log'; |
||
18 | |||
19 | public function __construct($numClassifier = 50) |
||
25 | |||
26 | /** |
||
27 | * This method is used to determine how much of the original columns (features) |
||
28 | * will be used to construct subsets to train base classifiers.<br> |
||
29 | * |
||
30 | * Allowed values: 'sqrt', 'log' or any float number between 0.1 and 1.0 <br> |
||
31 | * |
||
32 | * If there are many features that diminishes classification performance, then |
||
33 | * small values should be preferred, otherwise, with low number of features, |
||
34 | * default value (0.7) will result in satisfactory performance. |
||
35 | * |
||
36 | * @param mixed $ratio string or float should be given |
||
37 | * @return $this |
||
38 | * @throws Exception |
||
39 | */ |
||
40 | public function setFeatureSubsetRatio($ratio) |
||
51 | |||
52 | /** |
||
53 | * RandomForest algorithm is usable *only* with DecisionTree |
||
54 | * |
||
55 | * @param string $classifier |
||
56 | * @param array $classifierOptions |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function setClassifer(string $classifier, array $classifierOptions = []) |
||
67 | |||
68 | /** |
||
69 | * @param DecisionTree $classifier |
||
70 | * @param int $index |
||
71 | * @return DecisionTree |
||
72 | */ |
||
73 | protected function initSingleClassifier($classifier, $index) |
||
89 | } |
||
90 |