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

Stick breaking #2

Merged
merged 347 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
347 commits
Select commit Hold shift + click to select a range
ed37a5c
cargo fmt
cscherrer Feb 12, 2024
4fce680
first_n
cscherrer Feb 14, 2024
4e8d970
update tests
cscherrer Feb 14, 2024
95d0462
drop some old code
cscherrer Feb 14, 2024
d3f8fcb
cargo fmt
cscherrer Feb 14, 2024
72e4cd9
use ccdf
cscherrer Feb 15, 2024
33bab87
working on sbd
cscherrer Feb 15, 2024
4307f32
minor refactoring
cscherrer Feb 15, 2024
fd74ea1
bring sbd into scope
cscherrer Feb 15, 2024
b60bdb1
working on sbd
cscherrer Feb 15, 2024
d89e7b1
more sbd work
cscherrer Feb 15, 2024
0393680
cargo fmt
cscherrer Feb 15, 2024
4a15246
cargo fmt
cscherrer Feb 15, 2024
e96e96d
stickbreaking suffstat
cscherrer Feb 15, 2024
fd8653d
ix => n
cscherrer Feb 15, 2024
d237203
fix mode
cscherrer Feb 15, 2024
8ea0783
sample method for sbd
cscherrer Feb 15, 2024
5461e45
sbd sampling and tests
cscherrer Feb 16, 2024
5d9381c
drop some old code
cscherrer Feb 16, 2024
ba95485
mul_add suggestion from clippy
cscherrer Feb 16, 2024
3dffa09
cleaning up stick_sequence
cscherrer Feb 16, 2024
186d278
cargo fmt
cscherrer Feb 16, 2024
0785ad0
test length
cscherrer Feb 16, 2024
54daace
work on sbd_stat
cscherrer Feb 16, 2024
f13a4dc
Sbd.ln_f_stat
cscherrer Feb 20, 2024
08aa863
cargo fmt
cscherrer Feb 20, 2024
c274f94
trust clippy
cscherrer Feb 20, 2024
4299f47
drop redundant imports
cscherrer Feb 20, 2024
74fa247
Caching is faster, but not THAT MUCH faster
cscherrer Feb 20, 2024
a4140fc
Break Rv into Sampleable + HasDensity
cscherrer Feb 20, 2024
1284b24
cargo fmt
cscherrer Feb 20, 2024
ada53d8
Bring process traits back into traits.rs
cscherrer Feb 21, 2024
7767806
fix some docs and benches
cscherrer Feb 21, 2024
b82309e
bugfixes
cscherrer Feb 21, 2024
ba3113c
Propagate changes
cscherrer Feb 27, 2024
5fc7e3c
cargo fmt
cscherrer Feb 27, 2024
f55508a
make it type check
cscherrer Feb 27, 2024
df6f9d8
make clippy happy
cscherrer Feb 27, 2024
a017169
more clilppying
cscherrer Feb 27, 2024
06615e6
add breaks field
cscherrer Feb 27, 2024
3fa4287
drop dead code
cscherrer Feb 27, 2024
e5cd651
split suffstat into beta vs unitpowerlaw
cscherrer Mar 1, 2024
3d3ef9c
Fix StickBreaking HasDensity
cscherrer Mar 1, 2024
3017382
add missing type parameter
cscherrer Mar 1, 2024
95f833e
fix macro weirdness
cscherrer Mar 1, 2024
79d878d
Prior only needs Sampleable
cscherrer Mar 1, 2024
8a180af
cargo fmt
cscherrer Mar 1, 2024
47bd229
bernoulli_prior for UnbitPowerLaw
cscherrer Mar 5, 2024
f2ecf3b
simplify SticklBreaking SuffStat
cscherrer Mar 5, 2024
1f0ab97
Working on StickBreaking
cscherrer Mar 5, 2024
138f18d
Simplify interface
cscherrer Mar 7, 2024
f54ee16
Refactor ConjugatePrior
cscherrer Mar 8, 2024
66d8c0b
Drop DataOrSuffStat::None
cscherrer Mar 8, 2024
258f2fc
cargo fmt
cscherrer Mar 8, 2024
12bccad
fix redundant closures
cscherrer Mar 8, 2024
b1dafdd
break_pairs
cscherrer Mar 8, 2024
a6d08b9
cargo add itertools
cscherrer Mar 8, 2024
32d3088
posterior_from_suffstat
cscherrer Mar 8, 2024
b1ac654
impl From<&[usize]> for SbdSuffStat
cscherrer Mar 11, 2024
9f9e525
cargo fmt
cscherrer Mar 11, 2024
69cbdfa
marginal for stick breaking posterior
cscherrer Mar 11, 2024
20495d2
update StickBreaking::m
cscherrer Mar 12, 2024
e2397ae
StickBreaking::ln_m_with_cache
cscherrer Mar 12, 2024
c735d21
Sbd posterior predictive
cscherrer Mar 13, 2024
0a9d2ef
pp_with_cache
cscherrer Mar 13, 2024
e624ec7
LnFooCache => FooCache
cscherrer Mar 15, 2024
e9dd3fb
some docs
cscherrer Mar 17, 2024
78319c1
update sbd example
cscherrer Mar 18, 2024
1a556ba
StickBreaking example
cscherrer Mar 18, 2024
bddb923
Merge remote-tracking branch 'origin/master' into cs-experimental
cscherrer Mar 18, 2024
690dd50
cargo fmt
cscherrer Mar 18, 2024
5a8dcf6
fixed some missing renames
cscherrer Mar 18, 2024
38a00f0
fix missing rename
cscherrer Mar 18, 2024
63e097d
drop junk docs
cscherrer Mar 18, 2024
e093006
Bugfix for StickSequenceFmt
cscherrer Mar 19, 2024
4c52066
serde fix suggested by @BaxterEaves
cscherrer Mar 20, 2024
97bbdb6
cargo fmt
cscherrer Mar 20, 2024
2982138
make modules public
cscherrer Mar 20, 2024
c44f437
drop redundant test
cscherrer Mar 20, 2024
3ec46e6
fix typo
cscherrer Mar 21, 2024
387d669
use => pub use
cscherrer Mar 21, 2024
76e02b3
update mvg suffstat
cscherrer Mar 21, 2024
1fff55d
drop redundant imports
cscherrer Mar 21, 2024
b127411
oops committed junk code
cscherrer Mar 21, 2024
1241cc5
make clippy happy
cscherrer Mar 21, 2024
c8a46be
cargo fmt
cscherrer Mar 21, 2024
21661fd
Condition sbd example on experimental feature
cscherrer Mar 21, 2024
ac33f19
bump version
cscherrer Mar 21, 2024
3dacdb5
roll back `empty_suffstat`
cscherrer Mar 22, 2024
5c82e11
fix doctests
cscherrer Mar 22, 2024
8f0ad1c
drop dead code
cscherrer Mar 22, 2024
944e2c8
derive PartialEq for Sbd
cscherrer Mar 22, 2024
f2c2bbc
serde
cscherrer Mar 22, 2024
c631e7b
working on sb_ln_m_vs_monte_carlo test
cscherrer Mar 25, 2024
1642b00
test_stickseq_weights
cscherrer Mar 25, 2024
9ad37b8
sb_pp_posterior
cscherrer Mar 25, 2024
4426283
sb_repeated_obs_more_likely
cscherrer Mar 25, 2024
630c20d
simplify
cscherrer Mar 25, 2024
f31b89c
cargo fmt
cscherrer Mar 25, 2024
141ef63
#[cfg(feature = "serde1")]
cscherrer Mar 25, 2024
160d276
temp #[should_panic]
cscherrer Mar 25, 2024
0ae394f
cargo fmt
cscherrer Mar 25, 2024
8abbc52
drop should_panic
cscherrer Mar 25, 2024
dd456f9
sb_bayes_law
cscherrer Mar 26, 2024
458b402
sb_pp_is_quotient_of_marginals
cscherrer Mar 26, 2024
2a12d10
make alpha_inv and alpha_ln public
cscherrer Mar 26, 2024
3a99f8d
alpha.ln => alpha_ln()
cscherrer Mar 26, 2024
42047d6
add some tests
cscherrer Mar 26, 2024
f26c1c8
sb_logposterior_diff
cscherrer Mar 26, 2024
740c997
drop unnecessary `take`
cscherrer Mar 27, 2024
7ab7032
cargo fmt
cscherrer Mar 27, 2024
b1eb105
better typing
cscherrer Mar 27, 2024
d04ca1a
cargo fmt
cscherrer Mar 27, 2024
44994a5
Fix StickBreaking::ln_f
cscherrer Mar 27, 2024
5d3b0f5
termporary commenting-out stick_breaking_stat
cscherrer Mar 27, 2024
56d790f
simplify useless vecs
cscherrer Mar 27, 2024
2044419
cargo fmt
cscherrer Mar 27, 2024
43f5824
Simplify Sbd::ln_f_stat
cscherrer Mar 27, 2024
a628c71
bayes law passing!
cscherrer Mar 28, 2024
aba695b
Started Parameterized trait (mvg)
Mar 28, 2024
91fdd57
cargo fmt
cscherrer Mar 28, 2024
d1419af
push_to_ccdf
cscherrer Mar 28, 2024
84c4f3a
Impl Parameterized
Mar 29, 2024
967ce71
macro for testing ConjugatePrior
Mar 29, 2024
fc73b08
Add dummy StickBreaking conjugate prior test
Mar 29, 2024
6ef520f
Fix issue with dirichlet ln_m on categorical
Mar 29, 2024
b70933a
fix (?) stick breaking log-marginal
cscherrer Mar 29, 2024
09a3524
cargo fmt
cscherrer Mar 29, 2024
bf0e762
add some debug_assert!s
cscherrer Mar 29, 2024
be533e0
make multi_invccdf_sorted public
cscherrer Mar 30, 2024
53b91ee
rejection sampling for posterior
cscherrer Mar 30, 2024
c2a9baa
test_observe_and_forget
cscherrer Apr 1, 2024
868705f
update sb_posterior_rejection_sampling
cscherrer Apr 1, 2024
56cbfec
ln_m instead of m
cscherrer Apr 1, 2024
1832647
a little more verbose, but safer types
cscherrer Apr 1, 2024
8add17e
StickSequence::push_break
cscherrer Apr 2, 2024
f118c4d
Fix StickBreaking::draw
cscherrer Apr 2, 2024
59c0326
temp add lcov
cscherrer Apr 2, 2024
dfd0fdc
simplify ln_f_stat
cscherrer Apr 2, 2024
39d0ec9
drop lcov
cscherrer Apr 2, 2024
178d45f
add comment
cscherrer Apr 2, 2024
bc10c35
stickbreaking_posterior
cscherrer Apr 2, 2024
6389e50
clean up debug_assert!s
cscherrer Apr 2, 2024
353c5cc
update assert!
cscherrer Apr 2, 2024
6811d33
cargo fmt
cscherrer Apr 3, 2024
a8d469f
update Sbd support
cscherrer Apr 3, 2024
981674f
update tests
cscherrer Apr 3, 2024
bb523b6
test_sorted_uniforms
cscherrer Apr 3, 2024
e4f52aa
fix tests
cscherrer Apr 3, 2024
db71cc3
cargo fmt
cscherrer Apr 3, 2024
e1eb91b
comments
cscherrer Apr 3, 2024
a03ecb2
drop unused code
cscherrer Apr 3, 2024
88c1ec9
make test_sorted_uniforms quicker
cscherrer Apr 3, 2024
aa592fe
proptest!
cscherrer Apr 3, 2024
bf6056f
simplify sb_posterior_rejection_sampling
cscherrer Apr 4, 2024
5ef246e
Sbd => StickBreakingDiscrete
cscherrer Apr 4, 2024
8775563
cargo fmt
cscherrer Apr 4, 2024
c5474e6
drop unneeded imports
cscherrer Apr 4, 2024
58ccbe8
cargo fmt
cscherrer Apr 4, 2024
4b3bc33
fix stickbreaking_posterior when run without `experimental`
cscherrer Apr 4, 2024
bc81765
Fix test_sorted_uniforms test
cscherrer Apr 4, 2024
b611900
oops another fix
cscherrer Apr 4, 2024
aeac70d
more testing
cscherrer Apr 4, 2024
992aad0
cargo fmt
cscherrer Apr 4, 2024
3a85fc1
add some StickSequence tests
cscherrer Apr 5, 2024
940e9b6
make struct fields private
cscherrer Apr 5, 2024
531488a
alpha() method for StickBreaking
cscherrer Apr 5, 2024
155476a
add lcov.info to .gitignore
cscherrer Apr 5, 2024
c369688
cleaning up
cscherrer Apr 5, 2024
fe9f912
Drop some unneeded imports
cscherrer Apr 5, 2024
4e4bfb4
cargo fmt
cscherrer Apr 5, 2024
c024b6e
unbreak some things
cscherrer Apr 5, 2024
7993b9c
add num_weights_unstable
cscherrer Apr 5, 2024
80597e1
cargo fmt
cscherrer Apr 5, 2024
05bd569
simplify `ln_f` for StickBreaking
cscherrer Apr 5, 2024
569e376
more samples for sb_posterior_rejection_sampling
cscherrer Apr 5, 2024
2041aab
fix sb_posterior_rejection_sampling
cscherrer Apr 5, 2024
4526c85
add comment
cscherrer Apr 5, 2024
00b9577
making clippy happy
cscherrer Apr 8, 2024
8c2e080
more clippying
cscherrer Apr 8, 2024
b281a04
file reorg
cscherrer Apr 8, 2024
4983dbd
reorg
cscherrer Apr 8, 2024
c25fd4f
Revert "reorg"
cscherrer Apr 8, 2024
b54488b
Revert "file reorg"
cscherrer Apr 8, 2024
dea7ec5
reorg
cscherrer Apr 8, 2024
4a438ff
Merge remote-tracking branch 'origin/cs-experimental' into feature/fr…
Apr 9, 2024
58a3ca5
Remove 'datum' and fix some bugs
Apr 9, 2024
7f0a1c5
fix doctest
cscherrer Apr 9, 2024
1fe06fb
fix doctest
cscherrer Apr 9, 2024
f69f390
cargo fmt
cscherrer Apr 9, 2024
e1c586d
some clippy fixes
cscherrer Apr 9, 2024
716cfc2
cargo fmt
cscherrer Apr 9, 2024
e91713c
Merge pull request #4 from promised-ai/feature/from-parameters
cscherrer Apr 9, 2024
493aeed
drop redundant code
cscherrer Apr 9, 2024
6b4b907
update docs
cscherrer Apr 9, 2024
025f642
cargo fmt
cscherrer Apr 9, 2024
596a349
docs
cscherrer Apr 9, 2024
eda092c
add docs
cscherrer Apr 9, 2024
63ae686
proptestify quantile_agree_with_cdf (saw a failure)
cscherrer Apr 9, 2024
c859133
docs
cscherrer Apr 9, 2024
2a45185
docs
cscherrer Apr 9, 2024
8580323
docs
cscherrer Apr 9, 2024
b351701
doc fix
cscherrer Apr 10, 2024
6288414
fix hyperlinks
cscherrer Apr 10, 2024
0090c93
add experimental description
cscherrer Apr 10, 2024
d9bb5b2
Move suffstat_traits into traits
cscherrer Apr 10, 2024
a585bb3
drop suffstat_traits.rs
cscherrer Apr 10, 2024
d20dbcc
docs
cscherrer Apr 10, 2024
e6dac85
update docs
cscherrer Apr 10, 2024
d090af7
set_alpha
cscherrer Apr 10, 2024
aaf4074
add test
cscherrer Apr 10, 2024
0f5efd8
cargo fmt
cscherrer Apr 10, 2024
33f7c9e
use map_err
cscherrer Apr 10, 2024
318b0e4
cargo fmt
cscherrer Apr 10, 2024
5d97c15
debug_assert!(p > 0.0 && p < 1.0);
cscherrer Apr 10, 2024
6eedf3e
impl PartialEq<StickSequence> for StickSequence
cscherrer Apr 10, 2024
039469d
Fix "can't unwrap None" bug
cscherrer Apr 10, 2024
ec3dc0b
first draft of iterator_ext
cscherrer Apr 11, 2024
2a1b8a8
cargo fmt
cscherrer Apr 11, 2024
0a69aba
cargo fmt
cscherrer Apr 11, 2024
1f43e08
cargo fmt
cscherrer Apr 11, 2024
4875d9c
drop unneeded trait bound
cscherrer Apr 11, 2024
3c28080
update
cscherrer Apr 11, 2024
65a191a
StickBreaking entropy
cscherrer Apr 11, 2024
29687cd
update sbd example
cscherrer Apr 11, 2024
b3461b3
update sbd entropy
cscherrer Apr 11, 2024
acb6d74
.nth(0) => .next()
cscherrer Apr 11, 2024
e224e0c
InteratorExt => ConvergentSequence
cscherrer Apr 12, 2024
bef338f
ChaCha => Xoshiro256PlusPlus
cscherrer Apr 12, 2024
e0171cd
update sbd example
cscherrer Apr 12, 2024
580f4a0
simplify types
cscherrer Apr 12, 2024
fff1abd
Make aitken a little more robust
cscherrer Apr 12, 2024
f5fe248
bugfix
cscherrer Apr 12, 2024
83537f9
stick_breaking => stick_breaking_process
cscherrer Apr 14, 2024
cb6d1e1
Update CHANGELOG.md
cscherrer Apr 15, 2024
18e5580
update changelog
cscherrer Apr 15, 2024
672faa9
cargo fmt
cscherrer Apr 15, 2024
5958bb7
update changelog
cscherrer Apr 15, 2024
d49bf3e
add link to CHANGELOG.md
cscherrer Apr 15, 2024
339db73
bugfix
cscherrer Apr 15, 2024
9fa09ea
move sorted_uniforms to func.rs
cscherrer Apr 15, 2024
051e621
bugfix
cscherrer Apr 15, 2024
9464593
add sorted_uniforms to changelog
cscherrer Apr 15, 2024
41650ba
bugfix
cscherrer Apr 15, 2024
f365c8f
update CHANGELOG.md
cscherrer Apr 15, 2024
a3be9ca
bugfix
cscherrer Apr 15, 2024
4b22b5d
peroxide::prelude::gamma => crate::misc::gammafn
cscherrer Apr 16, 2024
2d196c8
move peroxide and proptest to dev-dependencies
cscherrer Apr 16, 2024
7e38e9d
make UnitPowerLawSuffStat fields private
cscherrer Apr 16, 2024
605d76c
drop unused `impl From<StickBreakingSuffStat> for UnitPowerLawSuffStat`
cscherrer Apr 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.vim
.helix
*.zip
lcov.info
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## [0.17.0] - 2024-05-15
- Add `experimental` module with `stick_breaking_process` submodule containing:
- `StickBreaking` struct representing a stick-breaking process
- `StickBreakingDiscrete` struct representing a discrete distribution based on a stick-breaking process
- `StickSequence` struct representing a sequence of stick breaks
- `BreakSequence` struct representing a sequence of break points
- `posterior` method on `StickBreaking` to compute the posterior distribution given data
- Various helper methods and trait implementations
- Update `ConjugatePrior`
- Change `LnMCache` to `MCache`
- Change `LnPpCache` to `PpCache`
- Split `Rv` into `Sampleable` and `HasDensity`
- Add `Process` generalizing `Rv`
- Add `Parameterized` trait
- Add `impl<X: Booleable> ConjugatePrior<X, Bernoulli> for UnitPowerLaw`
- Add `ConvergentSequence` implementing Aitken's delta-squared method
- Add `sorted_uniforms` helper function
- Minor stylistic changes suggested by Clippy


## [0.16.5] - 2024-03-14
- Moved repository to GitHub.

Expand Down Expand Up @@ -172,7 +192,7 @@
- Remove dependency on `quadrature` crate in favor of hand-rolled adaptive
Simpson's rule, which handles multimodal distributions better.


[0.17.0]: https://github.com/promise-ai/rv/compare/v0.16.5...v0.17.0
[0.16.5]: https://github.com/promise-ai/rv/compare/v0.16.4...v0.16.5
[0.16.4]: https://github.com/promise-ai/rv/compare/v0.16.3...v0.16.4
[0.16.3]: https://github.com/promise-ai/rv/compare/v0.16.2...v0.16.3
Expand Down
Loading