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,
40 IDataProvider *dprov) VIRTUAL_VOID;
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_
forpy::IThreshOpt::supports_weights
virtual bool supports_weights() const
Whether this threshold optimizer can take into account weights during the optimization.
Definition: ithreshopt.h:34
forpy::IThreshOpt
Find an optimal threshold.
Definition: ithreshopt.h:23
forpy::IThreshOpt::~IThreshOpt
virtual ~IThreshOpt()
Definition: ithreshopt.h:25
VIRTUAL_VOID
#define VIRTUAL_VOID
Definition: global.h:32
forpy::IDataProvider
A data provider for the training of one tree.
Definition: idataprovider.h:22
forpy::IThreshOpt::IThreshOpt
IThreshOpt()
Definition: ithreshopt.h:61
VIRTUAL_PTR
#define VIRTUAL_PTR
Definition: global.h:33
forpy::IThreshOpt::optimize
virtual void optimize(Desk *) const VIRTUAL_VOID
Optimize for one node.
VIRTUAL
#define VIRTUAL(type)
Definition: global.h:31
forpy::IThreshOpt::operator==
virtual bool operator==(const IThreshOpt &rhs) const VIRTUAL(bool)
forpy::IThreshOpt::transfer_or_run_check
virtual void transfer_or_run_check(IThreshOpt *other, IDataProvider *dprov) VIRTUAL_VOID
forpy::IThreshOpt::serialize
void serialize(Archive &, const uint &)
Definition: ithreshopt.h:66
forpy::IThreshOpt::create_duplicate
virtual std::shared_ptr< IThreshOpt > create_duplicate(const uint &random_seed) const VIRTUAL_PTR
forpy::IThreshOpt::check_annotations
virtual void check_annotations(IDataProvider *dprov) VIRTUAL_VOID
Validate annotations for usability with this optimizer.
forpy::IThreshOpt::get_gain_threshold_for
virtual float get_gain_threshold_for(const size_t &node_id) VIRTUAL(float)
Get the gain threshold to use for this node.
forpy
Definition: fastdprov.h:13
forpy::Desk
Main thread desk object.
Definition: desk.h:201
forpy::IThreshOpt::full_entropy
virtual void full_entropy(const IDataProvider &dprov, Desk *) const VIRTUAL_VOID
Get the full entropy for one node before optimization.
forpy::uint
unsigned int uint
Convenience typedef for unsigned int.
Definition: types.h:113