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

feat: [las] spanner rank one determinant update implementation #4090

Merged
merged 22 commits into from
Aug 12, 2022

Conversation

olgavrou
Copy link
Collaborator

@olgavrou olgavrou commented Aug 3, 2022

based on Sherman–Morrison formula and matrix determinant lemma

might templetize the two spanners later

float max_volume = -1.0f;
uint64_t U_rid{};
const Eigen::RowVectorXf original_row = X.row(X_rid);

for (auto i = 0; i < U.rows(); ++i)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we don't need to check all U rows, since some rows are already used in X, and using a duplicate row will make the determinant zero, and thereby not choosing it, but we'll pay the determinant computation cost. One potential optimization is to pass in the bit vector to eliminate already used rows, instead of trying all U rows, which might be more useful when d is big.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll benchmark this and see if it should be implemented next

for (auto it = preds.begin(); it != preds.end(); it++)
{
if (!_spanner_state._spanner_bitvec[index]) { preds.erase(it--); }
index++;
if (!_spanner_state._spanner_bitvec[it->action]) { preds.erase(it--); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it-- from begin() is undefined, although it later increases. Better make it safer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced

test/unit_test/cb_large_actions_test.cc Outdated Show resolved Hide resolved
@olgavrou olgavrou marked this pull request as ready for review August 12, 2022 16:47
@olgavrou
Copy link
Collaborator Author

I'll split the spanner implementations in next PR and do some cleanup

@olgavrou olgavrou merged commit 2762f04 into VowpalWabbit:master Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants