forpy  2
ithreshopt.h
Go to the documentation of this file.
1 /* Author: Christoph Lassner. */
2 #pragma once
3 #ifndef FORPY_THRESHOLD_OPTIMIZERS_ITHRESHOPT_H_
4 #define FORPY_THRESHOLD_OPTIMIZERS_ITHRESHOPT_H_
5 
6 #include "../global.h"
7 #include "../util/serialization/basics.h"
8 
9 #include "../data_providers/idataprovider.h"
10 #include "../types.h"
11 #include "../util/desk.h"
12 
13 namespace forpy {
14 
23 class IThreshOpt {
24  public:
25  virtual inline ~IThreshOpt(){};
26  virtual std::shared_ptr<IThreshOpt> create_duplicate(
27  const uint &random_seed) const VIRTUAL_PTR;
34  inline virtual bool supports_weights() const { return false; };
35 
37  virtual void check_annotations(IDataProvider *dprov) VIRTUAL_VOID;
38 
39  virtual void transfer_or_run_check(IThreshOpt *other,
41 
48  virtual void full_entropy(const IDataProvider &dprov,
49  Desk *) const VIRTUAL_VOID;
50 
52  virtual void optimize(Desk *) const VIRTUAL_VOID;
53 
55  virtual float get_gain_threshold_for(const size_t &node_id) VIRTUAL(float);
56 
57  virtual bool operator==(const IThreshOpt &rhs) const VIRTUAL(bool);
58 
59  protected:
61  inline IThreshOpt(){};
62 
63  private:
64  friend class cereal::access;
65  template <class Archive>
66  void serialize(Archive &, const uint &) {}
67 };
68 } // namespace forpy
69 #endif // FORPY_THRESHOLD_OPTIMIZERS_ITHRESHOPT_H_
virtual bool supports_weights() const
Whether this threshold optimizer can take into account weights during the optimization.
Definition: ithreshopt.h:34
Find an optimal threshold.
Definition: ithreshopt.h:23
virtual ~IThreshOpt()
Definition: ithreshopt.h:25
#define VIRTUAL_VOID
Definition: global.h:32
A data provider for the training of one tree.
Definition: idataprovider.h:22
#define VIRTUAL_PTR
Definition: global.h:33
virtual void optimize(Desk *) const VIRTUAL_VOID
Optimize for one node.
#define VIRTUAL(type)
Definition: global.h:31
virtual bool operator==(const IThreshOpt &rhs) const VIRTUAL(bool)
virtual void transfer_or_run_check(IThreshOpt *other, IDataProvider *dprov) VIRTUAL_VOID
void serialize(Archive &, const uint &)
Definition: ithreshopt.h:66
virtual std::shared_ptr< IThreshOpt > create_duplicate(const uint &random_seed) const VIRTUAL_PTR
virtual void check_annotations(IDataProvider *dprov) VIRTUAL_VOID
Validate annotations for usability with this optimizer.
virtual float get_gain_threshold_for(const size_t &node_id) VIRTUAL(float)
Get the gain threshold to use for this node.
Main thread desk object.
Definition: desk.h:201
virtual void full_entropy(const IDataProvider &dprov, Desk *) const VIRTUAL_VOID
Get the full entropy for one node before optimization.
unsigned int uint
Convenience typedef for unsigned int.
Definition: types.h:113