-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implementation of methods with API modifications #18
Conversation
…on linear shrinkage targets with lw shrinkage
Very good PR! I don't mind it's big. A few comments:
we'd have
with most of the current code (without
that calls the previous function with appropriately calculated
Good work :) |
Yeah I thought about 1, I'll do that. Re (2) I agree with you, probably not great practice. I think the NaN case is very unlikely, +-large number is much more likely but that gets clamped so it's fine. Do you think it makes sense to have the clamping in |
…pe, clamp outside of linshrink
I think it's OK to have |
Codecov Report
@@ Coverage Diff @@
## master #18 +/- ##
===========================================
- Coverage 92.39% 57.65% -34.74%
===========================================
Files 4 3 -1
Lines 92 111 +19
===========================================
- Hits 85 64 -21
- Misses 7 47 +40
Continue to review full report at Codecov.
|
ok, I've put it out now and think it's ok actually, give me one more commit before merging, I'm putting the |
ok done, feel free to merge if you're happy with the changes. One side note that I forgot to add, I started using \lambda instead of \rho for shrinkage as I thought it was clearer to distinguish with the |
Hello,
I'm sorry for the big PR ... I hope you won't mind the changes too much!
Here's a brief summary:
new-api-test
(seelinearshrinkage.jl
)DiagonalCommonVariance
targetandshrinkage
for alinear_shrinkage
function which does the same thing as what you were doing but adds the shrinkage:auto
for LedoitWolf shrinkage intensity,:lw
gives the same thing, it allows to have one target and three shrinkage intensity (:lw
,:rblw
: and:oas
) I think that it actually makes more sense than:optimal
Now things look like
(we can introduce tricks to make this less verbose later on as per #17 )
safe01clamp
works even ifx
isNaN
(in the pathological case whereS=F
it's possible though unlikely that we get a0.0/0.0
, sinceS=F
shrinkage doesn't matter --> returning 0.0, that's what you use to do, I think)linshrink
is the same as the oldshrink
but uses thesafe01clamp
simplecov
corresponds to your oldbasicmethods
, I thought thatsimple
made more sense since the estimator is calledSimple
linearshrinkage
has all the commmon targets + shrinkage, I thought this made sense and it's only 200 loc so I thought it wasn't too bad to put everything in one placeStuff that may not be obvious:
sum_var_sij
corresponds to the recurring numerator in http://strimmerlab.org/publications/journals/shrinkcov2005.pdf table 2sum_fij
corresponds to the sum of thefij
for i \neq j also in that tablesum((S-F).^2)
tr(X*X)
viadot(X, transpose(X))
but actually in our caseX
is symmetric and so this is justsum(X.^2)
The tests are essentially the same in terms of what they test, just the few modifications here and there to match the API changes.
Let me know what you think! and apologies again for the big changes in one shot...
Note: assuming you're happy with the changes, I'll fix the README.