mlpack 3.4.2
binary_numeric_split_info.hpp
Go to the documentation of this file.
1
13#ifndef MLPACK_METHODS_HOEFFDING_TREES_BINARY_NUMERIC_SPLIT_INFO_HPP
14#define MLPACK_METHODS_HOEFFDING_TREES_BINARY_NUMERIC_SPLIT_INFO_HPP
15
16#include <mlpack/prereqs.hpp>
17
18namespace mlpack {
19namespace tree {
20
21template<typename ObservationType = double>
23{
24 public:
25 BinaryNumericSplitInfo() { /* Nothing to do. */ }
26 BinaryNumericSplitInfo(const ObservationType& splitPoint) :
27 splitPoint(splitPoint) { /* Nothing to do. */ }
28
29 template<typename eT>
30 size_t CalculateDirection(const eT& value) const
31 {
32 return (value < splitPoint) ? 0 : 1;
33 }
34
36 template<typename Archive>
37 void serialize(Archive& ar, const unsigned int /* version */)
38 {
39 ar & BOOST_SERIALIZATION_NVP(splitPoint);
40 }
41
42 private:
43 ObservationType splitPoint;
44};
45
46} // namespace tree
47} // namespace mlpack
48
49#endif
BinaryNumericSplitInfo(const ObservationType &splitPoint)
size_t CalculateDirection(const eT &value) const
void serialize(Archive &ar, const unsigned int)
Serialize the split (save/load the split points).
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.