Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c++] Initial Work for Pairwise Ranking #6182

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
9ae3476
initial work for pairwise ranking (dataset part)
shiyu1994 Nov 8, 2023
2314099
remove unrelated changes
shiyu1994 Nov 8, 2023
06ddf68
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Nov 8, 2023
42e91e2
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Nov 23, 2023
a8379d4
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Dec 1, 2023
da5f02d
first version of pairwie ranking bin
shiyu1994 Dec 5, 2023
9d0afd9
Merge branch 'pairwise-ranking-dev' of https://github.com/Microsoft/L…
shiyu1994 Dec 5, 2023
0cb436d
templates for bins in pairwise ranking dataset
shiyu1994 Dec 5, 2023
fc9b381
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Dec 5, 2023
6fbc674
fix lint issues and compilation errors
shiyu1994 Dec 6, 2023
6082913
Merge branch 'pairwise-ranking-dev' of https://github.com/Microsoft/L…
shiyu1994 Dec 6, 2023
9e16dc3
add methods for pairwise bin
shiyu1994 Dec 6, 2023
6154bde
instantiate templates
shiyu1994 Dec 6, 2023
3a646eb
remove unrelated files
shiyu1994 Dec 6, 2023
9e77ab9
add return values for unimplemented methods
shiyu1994 Dec 7, 2023
eba4560
add new files and windows/LightGBM.vcxproj and windows/LightGBM.vcxpr…
shiyu1994 Dec 7, 2023
f1d2281
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Dec 7, 2023
873d7ad
create pairwise dataset
shiyu1994 Dec 7, 2023
3838b9b
Merge branch 'pairwise-ranking-dev' of https://github.com/Microsoft/L…
shiyu1994 Dec 7, 2023
986a979
set num_data_ of pairwise dataset
shiyu1994 Dec 7, 2023
c40965a
skip query with no paired items
shiyu1994 Dec 15, 2023
97d34d7
store original query information
shiyu1994 Jan 31, 2024
1e57e27
copy position information for pairwise dataset
shiyu1994 Jan 31, 2024
1699c06
rename to pointwise members
shiyu1994 Feb 1, 2024
d5b6f0a
adding initial support for pairwise gradients and NDCG eval with pair…
metpavel Feb 9, 2024
2ee1199
fix score offsets
metpavel Feb 9, 2024
fe10a2c
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Feb 19, 2024
0aaf090
skip copy for weights and label if none
shiyu1994 Feb 19, 2024
8714bfb
fix pairwise dataset bugs
shiyu1994 Feb 29, 2024
250996b
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Feb 29, 2024
38b2f3e
fix validation set with pairwise lambda rank
shiyu1994 Feb 29, 2024
09fff25
Merge branch 'pairwise-ranking-dev' of https://github.com/Microsoft/L…
shiyu1994 Feb 29, 2024
ba3c815
fix pairwise ranking objective initialization
shiyu1994 Feb 29, 2024
d9b537d
keep the original query boundaries and add pairwise query boundaries
shiyu1994 Feb 29, 2024
362baf8
allow empty queries in pairwise query boundaries
shiyu1994 Mar 1, 2024
06597ac
fix query boundaries
shiyu1994 Mar 1, 2024
18e3a1b
clean up
shiyu1994 Mar 1, 2024
43b8582
various fixes
metpavel Mar 1, 2024
ad4e89f
construct all pairs for validation set
shiyu1994 Mar 1, 2024
dc17309
Merge branch 'pairwise-ranking-dev' of https://github.com/microsoft/L…
metpavel Mar 1, 2024
1ad78b2
fix for validation set
shiyu1994 Mar 1, 2024
9cd3b93
fix validation pairs
shiyu1994 Mar 1, 2024
f9d9c07
fatal error when no query boundary is provided
shiyu1994 Mar 1, 2024
97e0a81
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Mar 1, 2024
746bc82
add differential features
shiyu1994 Mar 8, 2024
f9ab075
add differential features
shiyu1994 Mar 20, 2024
7aa170b
bug fixing and efficiency improvement
metpavel Mar 25, 2024
abdb716
add feature group for differential features
shiyu1994 Mar 27, 2024
3cdfd83
refactor template initializations with macro
shiyu1994 Mar 28, 2024
3703495
tree learning with differential features
shiyu1994 Mar 28, 2024
8f55a93
avoid copy sampled values
shiyu1994 Mar 28, 2024
8c3e7be
fix sampled indices
shiyu1994 Apr 2, 2024
5aa2d17
push data into differential features
shiyu1994 Apr 11, 2024
1c319b8
fix differential feature bugs
shiyu1994 Apr 17, 2024
d8eb68b
clean up debug code
shiyu1994 Apr 17, 2024
b088236
fix validation set with differential features
shiyu1994 Apr 18, 2024
2d09897
support row-wise histogram construction with pairwise ranking
shiyu1994 Jun 15, 2024
406d0c1
fix row wise in pairwise ranking
shiyu1994 Jun 20, 2024
6c65d1f
save for debug
shiyu1994 Jun 20, 2024
7738915
update code for debug
shiyu1994 Jun 28, 2024
d6c16df
save changes
shiyu1994 Jul 4, 2024
0d572d7
save changes for debug
shiyu1994 Jul 8, 2024
1f59f85
save changes
shiyu1994 Aug 21, 2024
0618bb2
add bagging by query for lambdarank
shiyu1994 Aug 27, 2024
185bdf6
Merge branch 'master' into bagging/bagging-by-query-for-lambdarank
shiyu1994 Aug 27, 2024
38fa4c2
fix pre-commit
shiyu1994 Aug 27, 2024
2fce147
Merge branch 'bagging/bagging-by-query-for-lambdarank' of https://git…
shiyu1994 Aug 27, 2024
1f7f967
Merge branch 'master' into bagging/bagging-by-query-for-lambdarank
shiyu1994 Aug 29, 2024
9e2a322
fix bagging by query with cuda
shiyu1994 Aug 29, 2024
666c51e
fix bagging by query test case
shiyu1994 Aug 30, 2024
9e2c338
fix bagging by query test case
shiyu1994 Aug 30, 2024
3abbc11
fix bagging by query test case
shiyu1994 Aug 30, 2024
13fa0a3
add #include <vector>
shiyu1994 Aug 30, 2024
b8427b0
merge bagging by query
shiyu1994 Sep 4, 2024
0258f07
update CMakeLists.txt
shiyu1994 Sep 4, 2024
90a95fa
fix bagging by query with pairwise lambdarank
shiyu1994 Sep 20, 2024
306af04
Merge branch 'master' into pairwise-ranking-dev
shiyu1994 Sep 20, 2024
b69913d
fix compilation error C3200 with visual studio
shiyu1994 Oct 10, 2024
6dba1cf
clean up main.cpp
shiyu1994 Oct 11, 2024
3b2e29d
Exposing configuration parameters for pairwise ranking
metpavel Oct 18, 2024
f1c32d3
fix bugs and pass by reference for SigmoidCache&
shiyu1994 Nov 8, 2024
51693e2
add pairing approach
shiyu1994 Nov 8, 2024
5071842
add at_least_one_relevant
shiyu1994 Nov 8, 2024
598764b
fix num bin for row wise in pairwise ranking
shiyu1994 Nov 21, 2024
f7deab4
save for debug
shiyu1994 Dec 17, 2024
0d1b310
update doc
shiyu1994 Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ set(
src/io/parser.cpp
src/io/train_share_states.cpp
src/io/tree.cpp
src/io/pairwise_lambdarank_bin.cpp
src/io/pairwise_ranking_feature_group.cpp
src/metric/dcg_calculator.cpp
src/metric/metric.cpp
src/network/linker_topo.cpp
Expand Down
66 changes: 66 additions & 0 deletions docs/Parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ Core Parameters

- ``rank_xendcg`` is faster than and achieves the similar performance as ``lambdarank``

- ``pairwise_lambdarank``, pairwise lambdarank algorithm

- label should be ``int`` type, and larger number represents the higher relevance (e.g. 0:bad, 1:fair, 2:good, 3:perfect)

- custom objective function (gradients and hessians not computed directly by LightGBM)
Expand Down Expand Up @@ -413,6 +415,10 @@ Learning Control Parameters

- random seed for bagging

- ``bagging_by_query`` :raw-html:`<a id="bagging_by_query" title="Permalink to this parameter" href="#bagging_by_query">&#x1F517;&#xFE0E;</a>`, default = ``false``, type = bool

- whether to do bagging sample by query

- ``feature_fraction`` :raw-html:`<a id="feature_fraction" title="Permalink to this parameter" href="#feature_fraction">&#x1F517;&#xFE0E;</a>`, default = ``1.0``, type = double, aliases: ``sub_feature``, ``colsample_bytree``, constraints: ``0.0 < feature_fraction <= 1.0``

- LightGBM will randomly select a subset of features on each iteration (tree) if ``feature_fraction`` is smaller than ``1.0``. For example, if you set it to ``0.8``, LightGBM will select 80% of features before training each tree
Expand Down Expand Up @@ -1214,6 +1220,66 @@ Objective Parameters

- *New in version 4.1.0*

- ``use_differential_feature_in_pairwise_ranking`` :raw-html:`<a id="use_differential_feature_in_pairwise_ranking" title="Permalink to this parameter" href="#use_differential_feature_in_pairwise_ranking">&#x1F517;&#xFE0E;</a>`, default = ``false``, type = bool

- whether to use differential features in pairwise ranking

- used only in ``pairwise_lambdarank`` application

- ``pairwise_lambdarank_model_indirect_comparison`` :raw-html:`<a id="pairwise_lambdarank_model_indirect_comparison" title="Permalink to this parameter" href="#pairwise_lambdarank_model_indirect_comparison">&#x1F517;&#xFE0E;</a>`, default = ``false``, type = bool

- whether to additionaly perform indirect document comparison in pairwise ranking

- used only in ``pairwise_lambdarank`` application

- ``pairwise_lambdarank_model_conditional_rel`` :raw-html:`<a id="pairwise_lambdarank_model_conditional_rel" title="Permalink to this parameter" href="#pairwise_lambdarank_model_conditional_rel">&#x1F517;&#xFE0E;</a>`, default = ``false``, type = bool

- whether to model conditional document relevance (given documents ranked above) in pairwise ranking

- used only in ``pairwise_lambdarank`` application

- ``pairwise_lambdarank_indirect_comparison_above_only`` :raw-html:`<a id="pairwise_lambdarank_indirect_comparison_above_only" title="Permalink to this parameter" href="#pairwise_lambdarank_indirect_comparison_above_only">&#x1F517;&#xFE0E;</a>`, default = ``true``, type = bool

- whether to limit the indirect document comparison to only auxilliary documents ranked above in pairwise ranking

- used only in ``pairwise_lambdarank`` application

- ``pairwise_lambdarank_logarithmic_discounts`` :raw-html:`<a id="pairwise_lambdarank_logarithmic_discounts" title="Permalink to this parameter" href="#pairwise_lambdarank_logarithmic_discounts">&#x1F517;&#xFE0E;</a>`, default = ``true``, type = bool

- whether to use logarithmic discounts when converting pairwise scores into pointwise in pairwise ranking

- used only in ``pairwise_lambdarank`` application

- ``pairwise_lambdarank_hard_pairwise_preference`` :raw-html:`<a id="pairwise_lambdarank_hard_pairwise_preference" title="Permalink to this parameter" href="#pairwise_lambdarank_hard_pairwise_preference">&#x1F517;&#xFE0E;</a>`, default = ``false``, type = bool

- whether to use hard pairwise preference when converting pairwise scores into pointwise in pairwise ranking

- used only in ``pairwise_lambdarank`` application

- ``pairwise_lambdarank_train_pairing_approach`` :raw-html:`<a id="pairwise_lambdarank_train_pairing_approach" title="Permalink to this parameter" href="#pairwise_lambdarank_train_pairing_approach">&#x1F517;&#xFE0E;</a>`, default = ``std::string("different_relevance")``, type = string

- pairing appraoch for training dataset

- used only in ``pairwise_lambdarank`` application

- with ``different_relevance``, only consider pairs with difference relevance score

- with ``at_least_one_relevant``, only consider pairs with at least one relevant item

- with ``all``, all pairs will be used

- ``pairwise_lambdarank_valid_pairing_approach`` :raw-html:`<a id="pairwise_lambdarank_valid_pairing_approach" title="Permalink to this parameter" href="#pairwise_lambdarank_valid_pairing_approach">&#x1F517;&#xFE0E;</a>`, default = ``std::string("different_relevance")``, type = string

- pairing appraoch for validation dataset

- used only in ``pairwise_lambdarank`` application

- with ``different_relevance``, only consider pairs with difference relevance score

- with ``at_least_one_relevant``, only consider pairs with at least one relevant item

- with ``all``, all pairs will be used

Metric Parameters
-----------------

Expand Down
75 changes: 72 additions & 3 deletions include/LightGBM/bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <functional>
#include <sstream>
#include <unordered_map>
#include <utility>
#include <vector>

namespace LightGBM {
Expand Down Expand Up @@ -305,6 +306,10 @@ class Bin {
*/
virtual BinIterator* GetIterator(uint32_t min_bin, uint32_t max_bin, uint32_t most_freq_bin) const = 0;

virtual BinIterator* GetUnpairedIterator(uint32_t /* min_bin */, uint32_t /* max_bin */, uint32_t /* most_freq_bin */) const {
return nullptr;
}

/*!
* \brief Save binary data to file
* \param file File want to write
Expand Down Expand Up @@ -466,6 +471,64 @@ class Bin {
*/
static Bin* CreateSparseBin(data_size_t num_data, int num_bin);

/*!
* \brief Create object for bin data of the first feature in pair, used for pairwise ranking, for an original dense bin
* \param num_data Size of the pairwise dataset
* \param num_bin Number of bin
* \param paired_ranking_item_index_map Map from data index to the original index for items in the pair
* \return The bin data object
*/
static Bin* CreateDensePairwiseRankingFirstBin(data_size_t num_original_data, int num_bin, data_size_t num_pairs, const std::pair<data_size_t, data_size_t>* paired_ranking_item_index_map);

/*!
* \brief Create object for bin data of the first feature in pair, used for pairwise ranking, for an original sparse bin
* \param num_data Size of the pairwise dataset
* \param num_bin Number of bin
* \param paired_ranking_item_index_map Map from data index to the original index for items in the pair
* \return The bin data object
*/
static Bin* CreateSparsePairwiseRankingFirstBin(data_size_t num_original_data, int num_bin, data_size_t num_pairs, const std::pair<data_size_t, data_size_t>* paired_ranking_item_index_map);

/*!
* \brief Create object for bin data of the second feature in pair, used for pairwise ranking, for an original dense bin
* \param num_data Size of the pairwise dataset
* \param num_bin Number of bin
* \param paired_ranking_item_index_map Map from data index to the original index for items in the pair
* \return The bin data object
*/
static Bin* CreateDensePairwiseRankingSecondBin(data_size_t num_original_data, int num_bin, data_size_t num_pairs, const std::pair<data_size_t, data_size_t>* paired_ranking_item_index_map);

/*!
* \brief Create object for bin data of the second feature in pair, used for pairwise ranking, for an original sparse bin
* \param num_data Size of the pairwise dataset
* \param num_bin Number of bin
* \param paired_ranking_item_index_map Map from data index to the original index for items in the pair
* \return The bin data object
*/
static Bin* CreateSparsePairwiseRankingSecondBin(data_size_t num_original_data, int num_bin, data_size_t num_pairs, const std::pair<data_size_t, data_size_t>* paired_ranking_item_index_map);

/*!
* \brief Create object for bin data of the differential feature in pair, used for pairwise ranking, for an original dense bin
* \param num_data Size of the pairwise dataset
* \param num_bin Number of bin
* \param paired_ranking_item_index_map Map from data index to the original index for items in the pair
* \param diff_bin_mappers Bin mappers for differential features in this group
* \param bin_offsets Bin offsets in feature group
* \return The bin data object
*/
static Bin* CreateDensePairwiseRankingDiffBin(data_size_t num_original_data, int num_bin, data_size_t num_pairs, const std::pair<data_size_t, data_size_t>* paired_ranking_item_index_map, const std::vector<std::unique_ptr<const BinMapper>>* diff_bin_mappers, const std::vector<std::unique_ptr<const BinMapper>>* ori_bin_mappers, const std::vector<uint32_t>* bin_offsets, const std::vector<uint32_t>* diff_bin_offsets);

/*!
* \brief Create object for bin data of the differential feature in pair, used for pairwise ranking, for an original sparse bin
* \param num_data Size of the pairwise dataset
* \param num_bin Number of bin
* \param paired_ranking_item_index_map Map from data index to the original index for items in the pair
* \param diff_bin_mappers Bin mappers for differential features in this group
* \param bin_offsets Bin offsets in feature group
* \return The bin data object
*/
static Bin* CreateSparsePairwiseRankingDiffBin(data_size_t num_original_data, int num_bin, data_size_t num_pairs, const std::pair<data_size_t, data_size_t>* paired_ranking_item_index_map, const std::vector<std::unique_ptr<const BinMapper>>* diff_bin_mappers, const std::vector<std::unique_ptr<const BinMapper>>* ori_bin_mappers, const std::vector<uint32_t>* bin_offsets, const std::vector<uint32_t>* diff_bin_offsets);

/*!
* \brief Deep copy the bin
*/
Expand All @@ -474,6 +537,8 @@ class Bin {
virtual const void* GetColWiseData(uint8_t* bit_type, bool* is_sparse, std::vector<BinIterator*>* bin_iterator, const int num_threads) const = 0;

virtual const void* GetColWiseData(uint8_t* bit_type, bool* is_sparse, BinIterator** bin_iterator) const = 0;

int group_index_ = -1;
};


Expand All @@ -495,6 +560,8 @@ class MultiValBin {
const data_size_t* used_indices,
data_size_t num_used_indices) = 0;

virtual void DumpContent() const {}

virtual MultiValBin* CreateLike(data_size_t num_data, int num_bin,
int num_feature,
double estimate_element_per_row,
Expand Down Expand Up @@ -588,12 +655,14 @@ class MultiValBin {
virtual bool IsSparse() = 0;

static MultiValBin* CreateMultiValBin(data_size_t num_data, int num_bin,
int num_feature, double sparse_rate, const std::vector<uint32_t>& offsets);
int num_feature, double sparse_rate, const std::vector<uint32_t>& offsets, const bool use_pairwise_ranking,
const std::pair<data_size_t, data_size_t>* paired_ranking_item_global_index_map);

static MultiValBin* CreateMultiValDenseBin(data_size_t num_data, int num_bin,
int num_feature, const std::vector<uint32_t>& offsets);
int num_feature, const std::vector<uint32_t>& offsets, const bool use_pairwise_ranking,
const std::pair<data_size_t, data_size_t>* paired_ranking_item_global_index_map);

static MultiValBin* CreateMultiValSparseBin(data_size_t num_data, int num_bin, double estimate_element_per_row);
static MultiValBin* CreateMultiValSparseBin(data_size_t num_data, int num_bin, double estimate_element_per_row, const bool use_pairwise_ranking, const std::pair<data_size_t, data_size_t>* paired_ranking_item_global_index_map);

static constexpr double multi_val_bin_sparse_threshold = 0.25f;

Expand Down
47 changes: 47 additions & 0 deletions include/LightGBM/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ enum TaskType {
};
const int kDefaultNumLeaves = 31;

/*! \brief Types of pairwise ranking mode */
enum PairwiseRankingMode {
kNone, kFull, kRelevance, kManual
};

struct Config {
public:
Config() {}
Expand Down Expand Up @@ -157,6 +162,7 @@ struct Config {
// descl2 = ``lambdarank``, `lambdarank <https://proceedings.neurips.cc/paper_files/paper/2006/file/af44c4c56f385c43f2529f9b1b018f6a-Paper.pdf>`__ objective. `label_gain <#label_gain>`__ can be used to set the gain (weight) of ``int`` label and all values in ``label`` must be smaller than number of elements in ``label_gain``
// descl2 = ``rank_xendcg``, `XE_NDCG_MART <https://arxiv.org/abs/1911.09798>`__ ranking objective function, aliases: ``xendcg``, ``xe_ndcg``, ``xe_ndcg_mart``, ``xendcg_mart``
// descl2 = ``rank_xendcg`` is faster than and achieves the similar performance as ``lambdarank``
// descl2 = ``pairwise_lambdarank``, pairwise lambdarank algorithm
// descl2 = label should be ``int`` type, and larger number represents the higher relevance (e.g. 0:bad, 1:fair, 2:good, 3:perfect)
// desc = custom objective function (gradients and hessians not computed directly by LightGBM)
// descl2 = ``custom``
Expand Down Expand Up @@ -358,6 +364,9 @@ struct Config {
// desc = random seed for bagging
int bagging_seed = 3;

// desc = whether to do bagging sample by query
bool bagging_by_query = false;

// alias = sub_feature, colsample_bytree
// check = >0.0
// check = <=1.0
Expand Down Expand Up @@ -995,6 +1004,44 @@ struct Config {
// desc = *New in version 4.1.0*
double lambdarank_position_bias_regularization = 0.0;

// desc = whether to use differential features in pairwise ranking
// desc = used only in ``pairwise_lambdarank`` application
bool use_differential_feature_in_pairwise_ranking = false;

// desc = whether to additionaly perform indirect document comparison in pairwise ranking
// desc = used only in ``pairwise_lambdarank`` application
bool pairwise_lambdarank_model_indirect_comparison = false;

// desc = whether to model conditional document relevance (given documents ranked above) in pairwise ranking
// desc = used only in ``pairwise_lambdarank`` application
bool pairwise_lambdarank_model_conditional_rel = false;

// desc = whether to limit the indirect document comparison to only auxilliary documents ranked above in pairwise ranking
// desc = used only in ``pairwise_lambdarank`` application
bool pairwise_lambdarank_indirect_comparison_above_only = true;

// desc = whether to use logarithmic discounts when converting pairwise scores into pointwise in pairwise ranking
// desc = used only in ``pairwise_lambdarank`` application
bool pairwise_lambdarank_logarithmic_discounts = true;

// desc = whether to use hard pairwise preference when converting pairwise scores into pointwise in pairwise ranking
// desc = used only in ``pairwise_lambdarank`` application
bool pairwise_lambdarank_hard_pairwise_preference = false;

// desc = pairing appraoch for training dataset
// desc = used only in ``pairwise_lambdarank`` application
// desc = with ``different_relevance``, only consider pairs with difference relevance score
// desc = with ``at_least_one_relevant``, only consider pairs with at least one relevant item
// desc = with ``all``, all pairs will be used
std::string pairwise_lambdarank_train_pairing_approach = std::string("different_relevance");

// desc = pairing appraoch for validation dataset
// desc = used only in ``pairwise_lambdarank`` application
// desc = with ``different_relevance``, only consider pairs with difference relevance score
// desc = with ``at_least_one_relevant``, only consider pairs with at least one relevant item
// desc = with ``all``, all pairs will be used
std::string pairwise_lambdarank_valid_pairing_approach = std::string("different_relevance");

#ifndef __NVCC__
#pragma endregion

Expand Down
5 changes: 5 additions & 0 deletions include/LightGBM/cuda/cuda_objective_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class CUDAObjectiveInterface: public HOST_OBJECTIVE {
SynchronizeCUDADevice(__FILE__, __LINE__);
}

void GetGradients(const double* scores, const data_size_t /*num_sampled_queries*/, const data_size_t* /*sampled_query_indices*/, score_t* gradients, score_t* hessians) const override {
LaunchGetGradientsKernel(scores, gradients, hessians);
SynchronizeCUDADevice(__FILE__, __LINE__);
}

void RenewTreeOutputCUDA(const double* score, const data_size_t* data_indices_in_leaf, const data_size_t* num_data_in_leaf,
const data_size_t* data_start_in_leaf, const int num_leaves, double* leaf_value) const override {
global_timer.Start("CUDAObjectiveInterface::LaunchRenewTreeOutputCUDAKernel");
Expand Down
Loading