pub struct DependencyChain;Expand description
MIMIC-style dependency-chain model for continuous spaces.
Implements ProbabilityModel by fitting a greedy first-order dependency
chain over dimensions (see module docs for the algorithm, estimator
regularisation, and references). Fitness is accepted but ignored; the fit
is always unweighted.
Trait Implementations§
Source§impl Clone for DependencyChain
impl Clone for DependencyChain
Source§fn clone(&self) -> DependencyChain
fn clone(&self) -> DependencyChain
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DependencyChain
Source§impl Debug for DependencyChain
impl Debug for DependencyChain
Source§impl Default for DependencyChain
impl Default for DependencyChain
Source§fn default() -> DependencyChain
fn default() -> DependencyChain
Source§impl<B: Backend> ProbabilityModel<B> for DependencyChain
impl<B: Backend> ProbabilityModel<B> for DependencyChain
Source§fn fit(
&self,
params: &Self::Params,
prev: Option<&Self::State>,
population: Tensor<B, 2>,
fitness: Tensor<B, 1>,
device: &<B as BackendTypes>::Device,
) -> Self::State
fn fit( &self, params: &Self::Params, prev: Option<&Self::State>, population: Tensor<B, 2>, fitness: Tensor<B, 1>, device: &<B as BackendTypes>::Device, ) -> Self::State
Fit the dependency-chain model to the selected population.
When prev = None returns the prior (natural-order chain, uniform
init_mean / init_std, zero correlations). Otherwise:
- Computes per-dimension MLE means and standard deviations
(
÷kvariance, floored atmin_variance). - Builds the full
D × DPearson correlation matrix. - Applies the
|r| < 2/√ksignificance filter (see module docs for the estimator regularisation rationale) and clamps surviving correlations to[−0.9999, 0.9999]. - Converts to mutual information
MI = −0.5 · ln(1 − r²). - Builds the chain greedily: root = minimum-σ dimension, each subsequent link = unvisited dimension with the highest MI to the last chosen one.
The fitness argument is accepted but always ignored.
§Panics
Panics if the population tensor cannot be read back as f32
(.expect("population tensor must be readable as f32")), or with an
out-of-bounds index if the host buffer is shorter than k * d. Callers
must therefore pass an f32, (k, d)-shaped population tensor. The
unwrap() on the last greedy-chain iteration does not fire: at least one
unvisited dimension remains when d > 1.
Source§fn sample(
&self,
state: &Self::State,
n: usize,
rng: &mut dyn Rng,
device: &<B as BackendTypes>::Device,
) -> Tensor<B, 2>
fn sample( &self, state: &Self::State, n: usize, rng: &mut dyn Rng, device: &<B as BackendTypes>::Device, ) -> Tensor<B, 2>
Draw n genomes by ancestral sampling along the fitted chain.
The root dimension is sampled from its marginal Gaussian; each subsequent dimension is sampled from the conditional Gaussian given its parent’s sampled value:
μ_cond = μ_c + r · (σ_c / σ_p) · (x_parent − μ_p)
σ_cond = σ_c · √(1 − r²)All randomness is drawn from rng (host RNG only; never
Tensor::random / B::seed). The returned tensor has shape (n, D).
This is O(D) per individual drawn.
§Panics
Does not panic under normal operation. The Normal::new calls are
guarded: σ_c is floored at min_variance.sqrt() during fit, and
r is clamped to [-0.9999, 0.9999] so 1 − r² ≥ 0.0002 > 0.
Source§type Params = DependencyChainParams
type Params = DependencyChainParams
Source§type State = DependencyChainState
type State = DependencyChainState
Auto Trait Implementations§
impl Freeze for DependencyChain
impl RefUnwindSafe for DependencyChain
impl Send for DependencyChain
impl Sync for DependencyChain
impl Unpin for DependencyChain
impl UnsafeUnpin for DependencyChain
impl UnwindSafe for DependencyChain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more