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 
18 namespace mlpack {
19 namespace tree {
20 
21 template<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
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t CalculateDirection(const eT &value) const
void serialize(Archive &ar, const unsigned int)
Serialize the split (save/load the split points).
BinaryNumericSplitInfo(const ObservationType &splitPoint)