|
koho.cpp
1.1.0
|
Splitter to find the best split for a node. More...
#include <decision_tree.h>

Public Member Functions | |
| BestSplitter (OutputsIdx_t n_outputs, ClassesIdx_t *n_classes, ClassesIdx_t n_classes_max, FeaturesIdx_t n_features, SamplesIdx_t n_samples, ClassWeights_t *class_weight, FeaturesIdx_t max_features, unsigned long max_thresholds, RandomState const &random_state) | |
| Create and initialize a new best splitter. More... | |
| void | init_node (Classes_t *y, SamplesIdx_t start, SamplesIdx_t end) |
| Initialize node and calculate weighted histograms for all outputs and impurity for the node. More... | |
| void | split_feature (Features_t *X, Classes_t *y, std::vector< SamplesIdx_t > &s, FeaturesIdx_t feature, int &NA, Features_t &threshold, SamplesIdx_t &pos, double &improvement) |
| Find the best split and partition (actually sorted) samples for a given feature. More... | |
| void | split_feature_extreme_random (Features_t *X, Classes_t *y, std::vector< SamplesIdx_t > &s, FeaturesIdx_t feature, int &NA, Features_t &threshold, SamplesIdx_t &pos, double &improvement) |
| void | split_node (Features_t *X, Classes_t *y, FeaturesIdx_t &feature, int &NA, Features_t &threshold, SamplesIdx_t &pos, double &improvement) |
| Find the best split and partition (actually sorted) samples. More... | |
Public Attributes | |
| GiniCriterion | criterion |
Protected Attributes | |
| FeaturesIdx_t | n_features |
| SamplesIdx_t | n_samples |
| FeaturesIdx_t | max_features |
| unsigned long | max_thresholds |
| RandomState | random_state |
| std::vector< SamplesIdx_t > | samples |
| SamplesIdx_t | start |
| SamplesIdx_t | end |
Splitter to find the best split for a node.
| koho::BestSplitter::BestSplitter | ( | OutputsIdx_t | n_outputs, |
| ClassesIdx_t * | n_classes, | ||
| ClassesIdx_t | n_classes_max, | ||
| FeaturesIdx_t | n_features, | ||
| SamplesIdx_t | n_samples, | ||
| ClassWeights_t * | class_weight, | ||
| FeaturesIdx_t | max_features, | ||
| unsigned long | max_thresholds, | ||
| RandomState const & | random_state | ||
| ) |
Create and initialize a new best splitter.
| void koho::BestSplitter::init_node | ( | Classes_t * | y, |
| SamplesIdx_t | start, | ||
| SamplesIdx_t | end | ||
| ) |
Initialize node and calculate weighted histograms for all outputs and impurity for the node.
| void koho::BestSplitter::split_feature | ( | Features_t * | X, |
| Classes_t * | y, | ||
| std::vector< SamplesIdx_t > & | s, | ||
| FeaturesIdx_t | feature, | ||
| int & | NA, | ||
| Features_t & | threshold, | ||
| SamplesIdx_t & | pos, | ||
| double & | improvement | ||
| ) |
Find the best split and partition (actually sorted) samples for a given feature.
| void koho::BestSplitter::split_feature_extreme_random | ( | Features_t * | X, |
| Classes_t * | y, | ||
| std::vector< SamplesIdx_t > & | s, | ||
| FeaturesIdx_t | feature, | ||
| int & | NA, | ||
| Features_t & | threshold, | ||
| SamplesIdx_t & | pos, | ||
| double & | improvement | ||
| ) |
Find a split and partition samples for a given feature using the Extreme Random Tree formulation for the threshold.
| void koho::BestSplitter::split_node | ( | Features_t * | X, |
| Classes_t * | y, | ||
| FeaturesIdx_t & | feature, | ||
| int & | NA, | ||
| Features_t & | threshold, | ||
| SamplesIdx_t & | pos, | ||
| double & | improvement | ||
| ) |
Find the best split and partition (actually sorted) samples.
Find the split (feature, threshold) on samples[start:end] and partition samples[start:end] into samples[start:pos] and samples[pos:end] according to split.
Assuming: init_node()
| GiniCriterion koho::BestSplitter::criterion |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
1.8.13