jankrepl / jankrepl/deepdow

Trouble running code with CovarianceMatrix(sqrt=True)

Open
#108 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

Merry Christmas @jankrepl

I am having trouble running code with:

```
cov_layer = CovarianceMatrix(sqrt=True)
...
covmat_sqrt = cov_layer(rets)
```

I was wondering if this would be an equivalent replacement?:

```
cov_layer = CovarianceMatrix(sqrt=False)
...
covmat_sqrt = torch.sqrt(cov_layer(rets))
```
------------------------------------------------------------------------------------------------------------------------

Just in case you were curious, the error I was getting with `CovarianceMatrix(sqrt=True):`

> rets has NAN
warnings.warn('rets has NAN')
....
Intel MKL ERROR: Parameter 4 was incorrect on entry to SLASCL.
....
/deepdow/layers/misc.py", line 162, in compute_sqrt
_, s, v = m.svd()
RuntimeError: svd_cuda: the updating process of SBDSDC did not converge (error: 16)

However, when I checked `rets` before passing into `cov_layer` with `assert torch.all(torch.isnan(rets))`, no assert error occured.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at deepdow/layers/misc.py around compute_sqrt (line 162) and inspect the CovarianceMatrix(sqrt=True) path using the provided rets example. Reproduce the NaN warning and CUDA SVD failure, then determine the supported behavior for this input and whether the proposed torch.sqrt replacement is valid. Done means a confirmed diagnosis with a regression test or clear usage guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.