12 using FeatTypes = tuple<ArrayXf,ArrayXi,ArrayXb>;
13 constexpr auto size = std::tuple_size<FeatTypes>::value;
15 return std::make_tuple(feature,
threshold);
36 for (
unsigned i =0;
i<
s.size()-1; ++
i)
45 for (
unsigned i =0;
i<
s.size()-1; ++
i)
57 using T = std::decay_t<
decltype(
arg)>;
58 if constexpr (T::NumDimensions == 1)
61 return ArrayXb::Constant(
arg.size(),
true);
96 vector<float> class_weights;
98 class_weights.push_back(
99 float( (classes.cast<
int>() ==
int(
c)).count())/classes.size()
103 auto cw = VectorXf::Map(class_weights.data(), class_weights.size());
void bind_engine(py::module &m, string name)
holds variable type data.
class tree_node_< Node > TreeNode
std::variant< ArrayXb, ArrayXi, ArrayXf, ArrayXXb, ArrayXXi, ArrayXXf, TimeSeriesb, TimeSeriesi, TimeSeriesf, ArrayXbJet, ArrayXiJet, ArrayXfJet, ArrayXXbJet, ArrayXXiJet, ArrayXXfJet, TimeSeriesbJet, TimeSeriesiJet, TimeSeriesfJet > State
defines the possible types of data flowing thru nodes.
vector< float > get_thresholds< ArrayXb >(const ArrayXb &x)
tuple< string, float > get_best_variable_and_threshold(const Dataset &d, TreeNode &tn)
vector< float > get_thresholds< ArrayXfJet >(const ArrayXfJet &x)
ArrayXb threshold_mask< State >(const State &x, const float &threshold)
float gain(const ArrayXf &lsplit, const ArrayXf &rsplit, bool classification, vector< float > unique_classes)
vector< float > get_thresholds< ArrayXi >(const ArrayXi &x)
vector< float > get_thresholds< ArrayXf >(const ArrayXf &x)
float gini_impurity_index(const ArrayXf &classes, const vector< float > &unique_classes)
vector< float > get_thresholds< ArrayXiJet >(const ArrayXiJet &x)
vector< float > get_thresholds< ArrayXbJet >(const ArrayXbJet &x)
vector< T > unique(vector< T > w)
returns unique elements in vector
float variance(const ArrayXf &v)
calculate variance
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
Eigen::Array< fJet, Eigen::Dynamic, 1 > ArrayXfJet
Eigen::Array< int, Eigen::Dynamic, 1 > ArrayXi
Eigen::Array< bJet, Eigen::Dynamic, 1 > ArrayXbJet
Eigen::Array< iJet, Eigen::Dynamic, 1 > ArrayXiJet