Bug: Exploit Structure in get_fantasy_strategy #2494
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello :)
This PR is related to #2468 and cornellius-gp/linear_operator#93.
The
DefaultPredictionStrategy
'sget_fantasy_model
updates the gram matrix with new datapoints and updates thelik_train_train_covar
'sroot_decomposition
androot_inv_decomposition
caches by passing them to the constructor. However by usingto_dense
in lines 214-215, the caches in the__init__
on line 69 and 72 respectively are constructed withroot
andinv_root
of typetorch.tensor
which inRootLinearOperator.__init__
will assign aDenseLinearOperator
toself.root
sinceto_linear_operator
defaults toDenseLinearOperator
if provided with atorch.tensor
.As a result in
LinearOperator.cat_rows
, the objectE
will be of typeDenseLinearOperator
which in turn will fail the check for for triangular matrices here. This once again leads to astable_pinverse
with QR decomposition instead of exploiting a fast triangular solve to compute the inverse.