3 #ifndef FORPY_THRESHOLD_OPTIMIZERS_CLASSIFICATION_OPT_H_ 4 #define FORPY_THRESHOLD_OPTIMIZERS_CLASSIFICATION_OPT_H_ 7 #include "../util/serialization/basics.h" 9 #include "../impurities/ientropyfunction.h" 10 #include "../impurities/inducedentropy.h" 12 #include "../util/desk.h" 17 #pragma clang diagnostic push 18 #pragma clang diagnostic ignored "-Wunused-variable" 35 #ifdef FORPY_SKLEARN_COMPAT 40 #pragma clang diagnostic pop 68 const std::shared_ptr<IEntropyFunction> &entropy_function =
69 std::make_shared<InducedEntropy>(2));
74 const uint & )
const {
81 if (copt_ot !=
nullptr) {
106 stream <<
"forpy::ClassificationOpt";
120 template <
typename IT>
122 template <
typename IT>
124 template <
typename IT>
127 template <
class Archive>
129 ar(cereal::make_nvp(
"base", cereal::base_class<IThreshOpt>(
this)),
140 #endif // FORPY_THRESHOLD_OPTIMIZERS_CLASSIFICATION_OPT_H_ uint get_true_max_class() const
Find an optimal threshold.
Desk for decider training.
std::shared_ptr< IEntropyFunction > entropy_func
A data provider for the training of one tree.
virtual std::shared_ptr< IThreshOpt > create_duplicate(const uint &) const
Interface implementation.
virtual void optimize(Desk *) const
Interface implementation.
const size_t LOG_COPT_NID
Variables to control debugging and log output for the forpy::RegressionOpt.
float get_gain_threshold_for(const size_t &)
Interface implementation.
friend class cereal::access
virtual void full_entropy(const IDataProvider &dprov, Desk *) const
Interface implementation.
ClassificationOpt(const size_t &n_thresholds=0, const float &gain_threshold=1E-7f, const std::shared_ptr< IEntropyFunction > &entropy_function=std::make_shared< InducedEntropy >(2))
const bool LOG_COPT_ALLN
Variables to control debugging and log output for the forpy::RegressionOpt.
CEREAL_REGISTER_TYPE(forpy::ClassificationOpt)
friend std::ostream & operator<<(std::ostream &stream, const ClassificationOpt &)
std::shared_ptr< std::vector< uint > > class_transl_ptr
void serialize(Archive &ar, const uint &)
std::shared_ptr< std::vector< uint > > get_class_translation() const
const int DLOG_COPT_V
Variables to control debugging and log output for the forpy::RegressionOpt.
Optimize split thresholds to optimize classification results.
void transfer_or_run_check(IThreshOpt *other, IDataProvider *dprov)
Interface implementation.
SplitOptRes< IT > & optimize__setup(DeciderDesk &d) const
virtual void check_annotations(IDataProvider *dprov) VIRTUAL_VOID
Validate annotations for usability with this optimizer.
std::unique_ptr< std::vector< IT > > optimize__thresholds(Desk *d) const
DISALLOW_COPY_AND_ASSIGN(ClassificationOpt)
unsigned int uint
Convenience typedef for unsigned int.
const float CLASSOPT_EPS
Classification epsilon. No differences less than this are considered existent. This is relevant for: ...
bool operator==(const IThreshOpt &rhs) const
virtual void check_annotations(IDataProvider *dprov)
Interface implementation.
size_t get_n_classes() const
Get the determined number of classes.
void optimize__sort(DeciderDesk &d) const