From 6d300f3aca6987f2fbf11f89670eaab7a43b4adc Mon Sep 17 00:00:00 2001 From: Michael Rapp Date: Mon, 19 Aug 2024 18:24:30 +0200 Subject: [PATCH] Add create functions that accept arguments of type BitDecomposableStatisticVector to the class IDecomposableRuleEvaluationFactory. --- .../rule_evaluation_decomposable.hpp | 31 +++++++++++++++++++ .../rule_evaluation_decomposable_complete.hpp | 8 +++++ ...valuation_decomposable_complete_binned.hpp | 8 +++++ ...valuation_decomposable_partial_dynamic.hpp | 8 +++++ ...on_decomposable_partial_dynamic_binned.hpp | 8 +++++ ..._evaluation_decomposable_partial_fixed.hpp | 8 +++++ ...tion_decomposable_partial_fixed_binned.hpp | 8 +++++ .../rule_evaluation_decomposable_single.hpp | 8 +++++ .../rule_evaluation_decomposable_complete.cpp | 12 +++++++ ...valuation_decomposable_complete_binned.cpp | 14 +++++++++ ...valuation_decomposable_partial_dynamic.cpp | 14 +++++++++ ...on_decomposable_partial_dynamic_binned.cpp | 14 +++++++++ ..._evaluation_decomposable_partial_fixed.cpp | 14 +++++++++ ...tion_decomposable_partial_fixed_binned.cpp | 14 +++++++++ .../rule_evaluation_decomposable_single.cpp | 14 +++++++++ 15 files changed, 183 insertions(+) diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable.hpp index a419a37f44..f6d49b8ea4 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable.hpp @@ -3,6 +3,7 @@ */ #pragma once +#include "mlrl/boosting/data/vector_statistic_decomposable_bit.hpp" #include "mlrl/boosting/data/vector_statistic_decomposable_dense.hpp" #include "mlrl/boosting/rule_evaluation/rule_evaluation.hpp" #include "mlrl/common/indices/index_vector_complete.hpp" @@ -52,6 +53,36 @@ namespace boosting { */ virtual std::unique_ptr> create( const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const = 0; + + /** + * Creates a new instance of the class `IRuleEvaluation` that allows to calculate the predictions of rules + * that predict for all available outputs, based on the gradients and Hessians that are stored by a + * `BitDecomposableStatisticVector`. + * + * @param statisticVector A reference to an object of type `BitDecomposableStatisticVector`. This vector + * is only used to identify the function that is able to deal with this particular + * type of vector via function overloading + * @param indexVector A reference to an object of the type `CompleteIndexVector` that provides access + * to the indices of the outputs for which the rules may predict + * @return An unique pointer to an object of type `IRuleEvaluation` that has been created + */ + virtual std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const = 0; + + /** + * Creates a new instance of the class `IRuleEvaluation` that allows to calculate the predictions of rules + * that predict for a subset of the available outputs, based on the gradients and Hessians that are stored + * by a `BitDecomposableStatisticVector`. + * + * @param statisticVector A reference to an object of type `BitDecomposableStatisticVector`. This vector + * is only used to identify the function that is able to deal with this particular + * type of vector via function overloading + * @param indexVector A reference to an object of the type `PartialIndexVector` that provides access + * to the indices of the outputs for which the rules may predict + * @return An unique pointer to an object of type `IRuleEvaluation` that has been created + */ + virtual std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const = 0; }; } diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.hpp index ce978d785b..2f77b0f73a 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.hpp @@ -37,6 +37,14 @@ namespace boosting { std::unique_ptr> create( const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; }; } diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.hpp index 3070877d6d..c80b0ce88e 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.hpp @@ -44,6 +44,14 @@ namespace boosting { std::unique_ptr> create( const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; }; } diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.hpp index 0349b71afe..b167404dc9 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.hpp @@ -55,6 +55,14 @@ namespace boosting { const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const override; diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.hpp index d9e2b7986e..eabe812ffa 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.hpp @@ -62,6 +62,14 @@ namespace boosting { const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const override; diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.hpp index b18cb78db4..67df86d949 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.hpp @@ -55,6 +55,14 @@ namespace boosting { const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const override; diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.hpp index c378b69883..2a78325e09 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.hpp @@ -61,6 +61,14 @@ namespace boosting { const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const override; diff --git a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.hpp b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.hpp index 8b8ea2466d..4b7bd42dc8 100644 --- a/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.hpp +++ b/cpp/subprojects/boosting/include/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.hpp @@ -39,6 +39,14 @@ namespace boosting { const DenseDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const override; + + std::unique_ptr> create( + const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const override; + std::unique_ptr> create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const override; diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.cpp index 17635cda40..54a1c6286f 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete.cpp @@ -24,4 +24,16 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_); } + std::unique_ptr> DecomposableCompleteRuleEvaluationFactory::create( + const BitDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> DecomposableCompleteRuleEvaluationFactory::create( + const BitDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + } diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.cpp index b1baacec5e..0737a1480f 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_complete_binned.cpp @@ -28,4 +28,18 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_, std::move(labelBinningPtr)); } + std::unique_ptr> + DecomposableCompleteBinnedRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> + DecomposableCompleteBinnedRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + } diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.cpp index 967d3e9385..c2cf903c4f 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic.cpp @@ -107,6 +107,20 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_); } + std::unique_ptr> + DecomposableDynamicPartialRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> + DecomposableDynamicPartialRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + std::unique_ptr> DecomposableDynamicPartialRuleEvaluationFactory::create(const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const { diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.cpp index 98c149e026..cc1655361d 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_dynamic_binned.cpp @@ -115,6 +115,20 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_, std::move(labelBinningPtr)); } + std::unique_ptr> + DecomposableDynamicPartialBinnedRuleEvaluationFactory::create( + const BitDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> + DecomposableDynamicPartialBinnedRuleEvaluationFactory::create( + const BitDecomposableStatisticVector& statisticVector, const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + std::unique_ptr> DecomposableDynamicPartialBinnedRuleEvaluationFactory::create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const { diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.cpp index 35e5004354..f74fb030f1 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed.cpp @@ -99,6 +99,20 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_); } + std::unique_ptr> + DecomposableFixedPartialRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> + DecomposableFixedPartialRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + std::unique_ptr> DecomposableFixedPartialRuleEvaluationFactory::create(const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const { diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.cpp index 875953f9a3..ce56d0e935 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_partial_fixed_binned.cpp @@ -99,6 +99,20 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_, std::move(labelBinningPtr)); } + std::unique_ptr> + DecomposableFixedPartialBinnedRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> + DecomposableFixedPartialBinnedRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + std::unique_ptr> DecomposableFixedPartialBinnedRuleEvaluationFactory::create( const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const { diff --git a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.cpp b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.cpp index 4c4327f954..335556c1be 100644 --- a/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.cpp +++ b/cpp/subprojects/boosting/src/mlrl/boosting/rule_evaluation/rule_evaluation_decomposable_single.cpp @@ -91,6 +91,20 @@ namespace boosting { indexVector, l1RegularizationWeight_, l2RegularizationWeight_); } + std::unique_ptr> + DecomposableSingleOutputRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const CompleteIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + + std::unique_ptr> + DecomposableSingleOutputRuleEvaluationFactory::create(const BitDecomposableStatisticVector& statisticVector, + const PartialIndexVector& indexVector) const { + // TODO Implement + return nullptr; + } + std::unique_ptr> DecomposableSingleOutputRuleEvaluationFactory::create(const SparseDecomposableStatisticVector& statisticVector, const CompleteIndexVector& indexVector) const {