| 1 | <?php |
||
| 12 | class DecisionStump extends DecisionTree |
||
| 13 | { |
||
| 14 | use Trainable, Predictable; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | protected $columnIndex; |
||
| 20 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * A DecisionStump classifier is a one-level deep DecisionTree. It is generally |
||
| 24 | * used with ensemble algorithms as in the weak classifier role. <br> |
||
| 25 | * |
||
| 26 | * If columnIndex is given, then the stump tries to produce a decision node |
||
| 27 | * on this column, otherwise in cases given the value of -1, the stump itself |
||
| 28 | * decides which column to take for the decision (Default DecisionTree behaviour) |
||
| 29 | * |
||
| 30 | * @param int $columnIndex |
||
| 31 | */ |
||
| 32 | public function __construct(int $columnIndex = -1) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param array $samples |
||
| 41 | * @param array $targets |
||
| 42 | */ |
||
| 43 | public function train(array $samples, array $targets) |
||
| 56 | } |
||
| 57 |