-
Notifications
You must be signed in to change notification settings - Fork 137
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
Trouble running code with CovarianceMatrix(sqrt=True) #108
Comments
Merry Christmas @turmeric-blend! Thank you for the question! First of all, matrix square root and elementwise (Hadamard?) square root are two different operations. The reason why in where S is the matrix square root of the covariance matrix. It is only the last expression (created via With that in mind,
If one constructs
|
Thanks for the detailed explanation!
|
|
Okay that makes sense. Lastly since we are on the topic of
In this case the same thing applies to this part where it doesn't matter if we use sqrt or not if what goes in comes from a neural network?
|
|
hi @jankrepl , is there a rule of thumb for this? Like what is the typical ratio of lookback to assets.
|
I guess the main goal is to make sure that the covariance matrix is positive definite (this way the standard Markowitz optimization problem has a unique solution) https://quant.stackexchange.com/questions/57331/why-does-portfolio-optimization-require-a-positive-definite-covariance-matrix However, if I guess I would just use shrinkage or make sure |
Hi @jankrepl , I have stumbled upon a promising covariance estimation method that would do better when
as metioned by the paper. I think this would be a good addition to the One caveat is that since my knowledge is limited, I'm not sure how it helps with the positive definite properly (the authors use time-averaged negative log-likelihood as a measure of performance), maybe you could provide insights into this. The code is here, and it would be nice to have it in the style of a |
Merry Christmas @jankrepl
I am having trouble running code with:
I was wondering if this would be an equivalent replacement?:
Just in case you were curious, the error I was getting with
CovarianceMatrix(sqrt=True):
However, when I checked
rets
before passing intocov_layer
withassert torch.all(torch.isnan(rets))
, no assert error occured.The text was updated successfully, but these errors were encountered: