Comments (7)
I remember you mentioned about ParetoSmooth
migration. So, better fix will be to port compare
to ParetoSmooth
, right?
from statisticalrethinking.jl.
Hi Max ( @Shmuma ), also noted your 2 other issues on ParetoSmoothedImportanceSampling.jl.
All of this is changing with the recent release of a new package ParetoSmooth.jl. I haven't had time to update the :psis compare function in StatisticalRethinking.jl (which will look similar to waic, as in the book).
I did help on the loo_compare() in ParetoSmooth and there is an example of combining Turing.jl and ParetoSmooth.jl in ParetoSmooth's test suite (based on WaffleDivorce in fact). I did something similar for the Stan side (for now in the SR test suite).
The current state of affairs is:
-
ParetoSmoothedImportanceSampling.jl is deprecated and in SR v3.1 replaced by StatsModelComparisons.jl.
-
In v4 StatsModelComparisons.jl will be replaced by ParetoSmooth.jl (but this is not complete yet).
-
With the exception of the parameter penalty terms, all info for the :psis version is easily accessible from ParetoSmooth.jl (see the examples in the test script mentioned above).
-
Currently I am updating quadratic approximation stuff in SR, including the sample() function, as this was also updated in Turing. Most of this will move to StanQuap.jl but for Turing we do need the sample(::ModeResult) method. As soon as that is done I'll start working on the :psis part of compare.
Not ideal, but I can see the light at the end of the tunnel.
from statisticalrethinking.jl.
Hi Max (@Shmuma),
Oops, didn't see your 2nd comment. Yes, we should go the ParetoSmooth route and, as mentioned above, I already did some preliminary work. Any help would definitely be appreciated!
Also, on the other point I raise in my previous comment (item 4), what's your thinking about the sample(::ModeResult) function I noticed in your chapter 7 notebook, i.e. should sample() return a DataFrame or a Chain object (in Turing that would be an MCMCChains.Chain object, in StanQuap.jl sample(::QuapResult) would return a KeyedArray chain object)?
Or do you think a DataFrame suffices? Of course, using the Tables API the chains are easy to convert to a DataFrame.
from statisticalrethinking.jl.
Thanks for explaining!
Yes, I'll try to implement fixed version of compare(:psis)
and make a pull request.
Also, on the other point I raise in my previous comment (item 4), what's your thinking about the sample(::ModeResult) function I noticed in your chapter 7 notebook, i.e. should sample() return a DataFrame or a Chain object (in Turing that would be an MCMCChains.Chain object, in StanQuap.jl sample(::QuapResult) would return a KeyedArray chain object)?
Or do you think a DataFrame suffices? Of course, using the Tables API the chains are easy to convert to a DataFrame.
I'm not sure. Originally it was an ad-hoc solution to get samples from result of optimize
, so, I make it to return DataFrame for simplicity. But to follow Turing's API, Chain might be better approach.
from statisticalrethinking.jl.
Great!
FYI: There is also an ongoing discussion here about cutting back the dependencies of ParetoSmooth.jl to reduce compile time. That has never been a goal of mine but just wanted to mention it in light of this discussion. At some point we might have to switch to a new package LeaveOneOut.jl or so.
In your sample()method, you do something like:
function sample(qr::QuapResult, count::Int)::DataFrame
names = qr.params # coefnames(mode_result) in Turing
means = values(qr.coef) # coef(mode_result) in Turing
sigmas = Diagonal(qr.vcov) # stderror(mode_result) in Turing
DataFrame([
name => rand(Normal(μ, σ), count)
for (name, μ, σ) ∈ zip(names, means, sigmas)
])
end
In creating the QuapResult object I use:
...
distr = if size(vcov, 1) == 1
Normal(coefvalues[1], √vcov[1]) # Normal expects std
else
MvNormal(coefvalues, vcov) # MvNormal expects variance matrix
end
...
I wonder if this should also happen in sample()? But maybe this is taken care off in StatsBase.stderror?
from statisticalrethinking.jl.
Checked the latest version of the package and this function now working. Thanks a lot!
Now I can finish the chapter 7 notebook (which took me 1.5 months to complete), wheee!
from statisticalrethinking.jl.
Great. Once you're done I'll make a pass over the Pluto notebooks in StatisticalRethinkingTuring.jl to ensure they are up to date with your scripts (and include chapter 7).
from statisticalrethinking.jl.
Related Issues (20)
- TagBot trigger issue HOT 78
- Nevermind HOT 2
- Problem with Chains to DataFrame conversion HOT 7
- Function precis() is not robust to missing values HOT 1
- Reexporting of packages HOT 4
- StatisticalRethinking v4 (SR4) HOT 4
- Switching to ParetoSmooth.jl HOT 1
- Weird dependency error HOT 2
- '.git' folder is bloated with 1 Go of data ! HOT 6
- Citation HOT 2
- trankplots() and precis() function HOT 1
- Typo? HOT 1
- PI doc string needs updating HOT 11
- Tag StatisticalRethinking 2.1.2 HOT 1
- Tag StatisticalRethinking 2.1.3 HOT 5
- New version StatisticalRethinking.jl HOT 20
- StatisticalRethinking.jl v3: Just a set of methods (such as plotcoef, precis, etc.)? HOT 16
- Plotbounds for Turing HOT 4
- Version 0.9.0 without bounds HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statisticalrethinking.jl.