Skip to content
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

Dev #49

Merged
merged 268 commits into from
May 9, 2022
Merged

Dev #49

merged 268 commits into from
May 9, 2022

Conversation

cscherrer
Copy link
Collaborator

@cscherrer cscherrer commented May 5, 2022

Kernel/Kleisli contention

We originally had Kernel. But this is very overloaded across the ecosystem. Also, what we have isn't quite a Markov kernel, since it maps to more general measures. We had changed it to Kleisli, which is accurate, but the term is not in wide wide use, especially among those doing stats work.

This PR tries to find a middle ground with TransitionKernel. It's descriptive and more intuitive, while still being accurate. The smart constructor has been changed back to kernel, but we're no longer exporting it in order to avoid conflicts with other packages.

Conditional meausres

Soss and now Tilde use | for conditional models. But this should really be at the level of measures. So you can not express measure | constraint in the case where measure is over NamedTuples, and constraint is a particular named tuple.

One thing that may be surprising is that | in this PR does not change the dimensionality, but instead transforms the constrained dimension to a Dirac measure. I think this will be easier to later generalize to constraints that are not axis-aligned.

Likelihoods

Some updates here, as well as introduction of log_likelihood_ratio.

Pointwise Products

Slot names are changed to prior and likelihood for easier interpretation. I've added an iterate method, allowing μ, ℓ = (p::PointwiseProductMeasure).

Power measures

logdensity_def is simplified to use sum instead of an explicit for loop. Hopefully this will later make it easier to port to GPU methods.

PowerWeighted

In for example GLMs or Bayesian bootstrap, we want to consider each observation to have some weight. This is an exponent on the likelihood factor, or equivalently a multiplicative weight on the log-likelihood. Since ^ is already taken (and much more common than this) I've added

(d::AbstractMeasure)  α = powerweightedmeasure(d, α)

@github-actions
Copy link

github-actions bot commented May 5, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 5, 2022

Package name latest stable
MeasureTheory.jl

@codecov
Copy link

codecov bot commented May 5, 2022

Codecov Report

Merging #49 (417b2d0) into master (1d1ad53) will increase coverage by 1.28%.
The diff coverage is 23.65%.

❗ Current head 417b2d0 differs from pull request most recent head 11adfcf. Consider uploading reports for the commit 11adfcf to get more accurate results

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
+ Coverage   38.51%   39.80%   +1.28%     
==========================================
  Files          31       30       -1     
  Lines         727      706      -21     
==========================================
+ Hits          280      281       +1     
+ Misses        447      425      -22     
Impacted Files Coverage Δ
src/MeasureBase.jl 71.42% <ø> (ø)
src/combinators/conditional.jl 0.00% <0.00%> (ø)
src/combinators/likelihood.jl 6.66% <0.00%> (-18.34%) ⬇️
src/combinators/powerweighted.jl 0.00% <0.00%> (ø)
src/combinators/product.jl 3.52% <0.00%> (+0.37%) ⬆️
src/kernel.jl 0.00% <0.00%> (ø)
src/parameterized.jl 0.00% <0.00%> (ø)
src/utils.jl 40.62% <0.00%> (-3.45%) ⬇️
src/combinators/smart-constructors.jl 45.28% <23.07%> (+13.07%) ⬆️
src/combinators/pointwise.jl 41.66% <75.00%> (+41.66%) ⬆️
... and 10 more

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 1d1ad53...11adfcf. Read the comment docs.

@cscherrer cscherrer requested review from mschauer and theogf May 5, 2022 15:38
@github-actions
Copy link

github-actions bot commented May 5, 2022

Package name latest stable
MeasureTheory.jl

@cscherrer
Copy link
Collaborator Author

Hmm, tests passing on 1.8 and nightly, but not 1.6 or 1.7...

@github-actions
Copy link

github-actions bot commented May 5, 2022

Package name latest stable
MeasureTheory.jl

Copy link
Collaborator

@theogf theogf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not look at everything in detail (this is a massive PR). But generally, it looks like many tests are missing, I think I caught some wrong implementations which would have been caught with some unit tests. At some point, I would be happy to help with the reorganization of the tests for the package.
I would not delete completely kleisli, it's still a nice thing to know and learn, and it can be exported. Maybe just leave it as an alias to kernel ? It's just my opinion though.

src/combinators/likelihood.jl Show resolved Hide resolved
src/combinators/likelihood.jl Show resolved Hide resolved
src/combinators/likelihood.jl Show resolved Hide resolved
src/density.jl Outdated Show resolved Hide resolved
src/kernel.jl Show resolved Hide resolved
src/combinators/conditional.jl Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented May 5, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 6, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 6, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 6, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 6, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 9, 2022

Package name latest stable
MeasureTheory.jl

@github-actions
Copy link

github-actions bot commented May 9, 2022

Package name latest stable
MeasureTheory.jl

@cscherrer cscherrer merged commit 8744525 into master May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants