-
Notifications
You must be signed in to change notification settings - Fork 2
Make VonMises more flexible #33
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/v0.19.0 #33 +/- ##
===================================================
- Coverage 81.05% 80.70% -0.36%
===================================================
Files 98 98
Lines 19711 20081 +370
Branches 19711 20081 +370
===================================================
+ Hits 15977 16206 +229
- Misses 3619 3760 +141
Partials 115 115 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems reasonable. I like moving to named parameters too.
src/traits.rs
Outdated
@@ -8,6 +8,19 @@ pub trait Parameterized { | |||
fn emit_params(&self) -> Self::Parameters; | |||
|
|||
fn from_params(params: Self::Parameters) -> Self; | |||
|
|||
// TODO: If Self: Sized ok here? Should this be a requirement for the whole trait? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in every case the parameters should be sized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I changed it to
pub trait Parameterized: Sized {
type Parameters;
fn emit_params(&self) -> Self::Parameters;
fn from_params(params: Self::Parameters) -> Self;
fn map_params(
&self,
f: impl Fn(Self::Parameters) -> Self::Parameters,
) -> Self {
let params = self.emit_params();
let new_params = f(params);
Self::from_params(new_params)
}
}
Parameterized Trait Enhancement & VonMises Scaling Support
Summary
This PR introduces parameter structs for distributions and enhances the
Parameterized
trait with a defaultmap_params
implementation. It also adds scaling support for the VonMises distribution.Changes
1. Parameter Structs
BernoulliParameters
,GaussianParameters
)emit_params
andfrom_params
implementations to use these structs2. Enhanced
Parameterized
Traitmap_params
implementation that enables mapping functions over parameters3. VonMises Distribution Improvements
Scalable
trait implementation for VonMises distributionmap_params
implementation for efficient parameter updatesfrom_parts_unchecked
for more efficient construction4. Data Module Enhancements
DataOrSuffStat
and categorical datumTesting
Added comprehensive test coverage for all new functionality, including: