jankrepl / deepdow

Portfolio optimization with deep learning.
https://deepdow.readthedocs.io
Apache License 2.0
874 stars 136 forks source link

use linalg.solve in place of inverse #126

Closed mirca closed 2 years ago

mirca commented 2 years ago

Minor PR that bypasses the computation of the inverse of the covariance matrix by using torch.linalg.solve to compute the unnormalised vector of allocations.

Thanks.

jankrepl commented 2 years ago

Thank you for the PR! The CI is failing since there is a problem on master. I will try to fix it ASAP and then we can merge this PR.

codecov[bot] commented 2 years ago

Codecov Report

Merging #126 (b374c17) into master (a5a8b08) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #126   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         1773      1772    -1     
=========================================
- Hits          1773      1772    -1     
Impacted Files Coverage Δ
deepdow/layers/allocate.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a5a8b08...b374c17. Read the comment docs.

mirca commented 2 years ago

Yeh, that should be correct:) Plus it seems like it is more stable and faster https://pytorch.org/docs/stable/generated/torch.linalg.solve.html.

Thank you very much!

Yep, that was my rationale, should've made it clearer. Thanks for the library :)