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

Continued work on position unbiased ranking #5393

Closed
wants to merge 43 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e5b6f31
chore: ignore swig jni file
robhowley Feb 2, 2021
ca85e05
Merge pull request #1 from Zocdoc/rh_update_ignore
robert-howley-zocdoc Feb 2, 2021
7718343
chore: run tests on pr to position_debias
robhowley Feb 2, 2021
7063000
Update cuda.yml
robert-howley-zocdoc Feb 3, 2021
4f4387a
Merge pull request #2 from Zocdoc/rh_main_fork_branch
robert-howley-zocdoc Feb 3, 2021
482c143
feat: crude copy paste
robhowley Feb 3, 2021
4bae3ad
feat: add unbiased lambdamart config params
robhowley Feb 3, 2021
1449576
Merge pull request #3 from Zocdoc/rh_config
robert-howley-zocdoc Feb 3, 2021
c49005e
Merge branch 'position_unbiased' into rh_impl_phase_1
robhowley Feb 3, 2021
3cbcb62
chore: variable init
robhowley Feb 9, 2021
a0680e6
feat: add bias corrected lambda accumulators
robhowley Feb 9, 2021
8827540
chore: remove intermediate vectors
robhowley Feb 9, 2021
6798c2a
chore: address linter issues
robhowley Feb 9, 2021
e1c8158
chore: remove unused position_lambdas variable
robhowley Feb 9, 2021
26b316b
chore: remove unused position_scores variables
robhowley Feb 9, 2021
4b8c2e9
chore: remove position counts variables
robhowley Feb 9, 2021
c50e92c
chore: consolidate initialization and updates
robhowley Feb 10, 2021
592ade6
chore: linter whitespace
robhowley Feb 10, 2021
c29a6f8
chore: add comments on formulas and derivations
robhowley Feb 11, 2021
9796a72
chore: eta has slightly clearer/diff meaning in this impl
robhowley Feb 11, 2021
a00ac5c
fix: debias rank values
robhowley Feb 19, 2021
672ec5b
chore: linter
robhowley Feb 19, 2021
d3347d2
Merge pull request #4 from Zocdoc/rh_impl_phase_1
robert-howley-zocdoc Feb 23, 2021
88e3542
chore: give better name to bias regularizer
robhowley Feb 25, 2021
52f6243
Merge pull request #5 from Zocdoc/rh_better_eta_name
robert-howley-zocdoc Feb 25, 2021
99f4f04
chore: tests w configs relevant to unbiased
robhowley Mar 3, 2021
87219c2
chore: remove unused param, replaced by truncation_level
robhowley Mar 3, 2021
baa4a0d
Merge pull request #6 from Zocdoc/rh_remove_position_bins
robert-howley-zocdoc Mar 3, 2021
20fe972
fix: update workflow trigger to correct branch name
robhowley Mar 3, 2021
9ac06d5
merge conflicts
robhowley Aug 18, 2021
da17901
more merge conflicts
robhowley Aug 18, 2021
a821813
remove git workflow customizations
robhowley Aug 18, 2021
32aa904
remove extra comments
robhowley Aug 18, 2021
b450bfa
remove print statement
robhowley Aug 18, 2021
fc5b92d
remove test refactor, line spacing, and comment typo fix
robhowley Sep 7, 2021
ebb8f40
remove gitignore changes, more whitespace removal
robhowley Sep 7, 2021
6ae3cfe
end w new line
robhowley Sep 7, 2021
9572d7d
fix redundant blank line found in cpp lint
robhowley Sep 7, 2021
0cbe02d
Merge branch 'microsoft:master' into position_unbiased
robert-howley-zocdoc Dec 20, 2021
827a04a
merge origin/master
shiyu1994 Jul 28, 2022
42072d2
Merge remote-tracking branch 'origin/master' into position_unbiased
shiyu1994 Jul 29, 2022
ef89b41
apply review comments from shiyu1994 in #4531
shiyu1994 Jul 29, 2022
b0be720
use callback for early stopping
shiyu1994 Jul 29, 2022
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
Prev Previous commit
Next Next commit
chore: remove unused position_lambdas variable
robhowley committed Feb 9, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e1c81585cfe3f3e804faf8314fdc1fd0110d1d02
16 changes: 5 additions & 11 deletions src/objective/rank_objective.hpp
Original file line number Diff line number Diff line change
@@ -139,6 +139,10 @@ class LambdarankNDCG : public RankingObjective {
}
// construct sigmoid table to speed up sigmoid transform
ConstructSigmoidTable();

// initialize position bias vectors
InitPositionBiases();
InitPositionGradients();
}

void GetGradients(const double* score, score_t* gradients,
@@ -266,7 +270,6 @@ class LambdarankNDCG : public RankingObjective {
// calculate position score, and position lambda
for (data_size_t i = 0; i < cnt && i < truncation_level_; ++i) {
position_scores_buffer_[tid][i] += score[i];
position_lambdas_buffer_[tid][i] += lambdas[i];
}
}
}
@@ -311,21 +314,18 @@ class LambdarankNDCG : public RankingObjective {
void InitPositionGradients() {
position_cnts_.resize(truncation_level_);
position_scores_.resize(truncation_level_);
position_lambdas_.resize(truncation_level_);
i_costs_.resize(truncation_level_);
j_costs_.resize(truncation_level_);
for (int i = 0; i < truncation_level_; ++i) {
position_cnts_[i] = 0LL;
position_scores_[i] = 0.0f;
position_lambdas_[i] = 0.0f;
i_costs_[i] = 0.0f;
j_costs_[i] = 0.0f;
}

for (int i = 0; i < num_threads_; i++) {
position_cnts_buffer_.emplace_back(truncation_level_, 0LL);
position_scores_buffer_.emplace_back(truncation_level_, 0.0f);
position_lambdas_buffer_.emplace_back(truncation_level_, 0.0f);
i_costs_buffer_.emplace_back(truncation_level_, 0.0f);
j_costs_buffer_.emplace_back(truncation_level_, 0.0f);
}
@@ -337,7 +337,6 @@ class LambdarankNDCG : public RankingObjective {
for (int j = 0; j < truncation_level_; ++j) {
position_cnts_[j] += position_cnts_buffer_[i][j];
position_scores_[j] += position_scores_buffer_[i][j];
position_lambdas_[j] += position_lambdas_buffer_[i][j];
i_costs_[j] += i_costs_buffer_[i][j];
j_costs_[j] += j_costs_buffer_[i][j];
}
@@ -355,7 +354,6 @@ class LambdarankNDCG : public RankingObjective {
// Clear position info
position_cnts_[i] = 0LL;
position_scores_[i] = 0.0f;
position_lambdas_[i] = 0.0f;
i_costs_[i] = 0.0f;
j_costs_[i] = 0.0f;
}
@@ -365,7 +363,6 @@ class LambdarankNDCG : public RankingObjective {
for (int j = 0; j < truncation_level_; ++j) {
position_cnts_buffer_[i][j] = 0LL;
position_scores_buffer_[i][j] = 0.0f;
position_lambdas_buffer_[i][j] = 0.0f;
i_costs_buffer_[i][j] = 0.0f;
j_costs_buffer_[i][j] = 0.0f;
}
@@ -400,7 +397,6 @@ class LambdarankNDCG : public RankingObjective {
<< std::setw(15) << i_biases_pow_[i]
<< std::setw(15) << j_biases_pow_[i]
<< std::setw(15) << position_scores_[i] / num_queries_
<< std::setw(15) << -position_lambdas_[i] / num_queries_
<< std::setw(15) << 1.0f * position_cnts_[i] / position_cnts_sum
<< std::setw(15) << i_costs_[i] / position_cnts_sum
<< std::setw(15) << j_costs_[i] / position_cnts_sum
@@ -443,9 +439,7 @@ class LambdarankNDCG : public RankingObjective {
/*! \brief position scores */
mutable std::vector<label_t> position_scores_;
mutable std::vector<std::vector<label_t>> position_scores_buffer_;
/*! \brief position lambdas */
mutable std::vector<label_t> position_lambdas_;
mutable std::vector<std::vector<label_t>> position_lambdas_buffer_;

// mutable double position cost;
mutable std::vector<label_t> i_costs_;
mutable std::vector<std::vector<label_t>> i_costs_buffer_;