pub struct ParameterBlock<P, L, X, Penalty> { /* private fields */ }Expand description
Typed coefficient block for a single distribution parameter.
P specifies the parameter role, L specifies the link function, X holds
the predictor block, and Penalty adds regularization. The block stores its
coefficient range within the common beta vector; use Self::range and
Self::len to inspect that layout.
Implementations§
Source§impl<P, L, X, Penalty> ParameterBlock<P, L, X, Penalty>where
X: PredictorBlock,
impl<P, L, X, Penalty> ParameterBlock<P, L, X, Penalty>where
X: PredictorBlock,
Sourcepub fn new(
x: X,
penalty: Penalty,
offset: usize,
) -> ParameterBlock<P, L, X, Penalty>
pub fn new( x: X, penalty: Penalty, offset: usize, ) -> ParameterBlock<P, L, X, Penalty>
Creates a block, taking len from x.nparams().
Sourcepub fn from_predictor(
x: X,
penalty: Penalty,
offset: usize,
) -> ParameterBlock<P, L, X, Penalty>
pub fn from_predictor( x: X, penalty: Penalty, offset: usize, ) -> ParameterBlock<P, L, X, Penalty>
Creates a block from a generic predictor.
This is a synonym for Self::new, kept for code where the explicit
predictor word makes the call more readable.
Source§impl<P, L, X, Penalty> ParameterBlock<P, L, LinearPredictorBlock<X>, Penalty>where
X: DesignMatrix,
impl<P, L, X, Penalty> ParameterBlock<P, L, LinearPredictorBlock<X>, Penalty>where
X: DesignMatrix,
Sourcepub fn linear(
x: X,
penalty: Penalty,
offset: usize,
) -> ParameterBlock<P, L, LinearPredictorBlock<X>, Penalty>
pub fn linear( x: X, penalty: Penalty, offset: usize, ) -> ParameterBlock<P, L, LinearPredictorBlock<X>, Penalty>
Creates a linear block from a design matrix.
Source§impl<P, L, X, Penalty> ParameterBlock<P, L, X, Penalty>
impl<P, L, X, Penalty> ParameterBlock<P, L, X, Penalty>
Sourcepub const fn with_offset(
self,
offset: usize,
) -> ParameterBlock<P, L, X, Penalty>
pub const fn with_offset( self, offset: usize, ) -> ParameterBlock<P, L, X, Penalty>
Returns a copy of the block with a new offset.
Sourcepub const fn range(&self) -> Range<usize>
pub const fn range(&self) -> Range<usize>
Coefficient range of the block in the common beta vector.
§Panics
Panics if offset + len overflows. Use Self::try_range when the
offset may come from unchecked external input.
Sourcepub const fn end(&self) -> usize
pub const fn end(&self) -> usize
Index immediately after the last coefficient of the block.
§Panics
Panics if offset + len overflows. Use Self::try_range for
recoverable validation.
Source§impl<P, L, X, Penalty> ParameterBlock<P, L, X, Penalty>where
P: ParameterName,
impl<P, L, X, Penalty> ParameterBlock<P, L, X, Penalty>where
P: ParameterName,
Sourcepub fn try_range(&self) -> Result<Range<usize>, ModelError>
pub fn try_range(&self) -> Result<Range<usize>, ModelError>
Validates and returns the block’s coefficient range.
§Errors
Returns ModelError::BlockRangeOverflow if offset + len does not fit
in usize.
Trait Implementations§
Source§impl<P, L, X, Penalty> Clone for ParameterBlock<P, L, X, Penalty>
impl<P, L, X, Penalty> Clone for ParameterBlock<P, L, X, Penalty>
Source§fn clone(&self) -> ParameterBlock<P, L, X, Penalty>
fn clone(&self) -> ParameterBlock<P, L, X, Penalty>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<P, L, X, Penalty> Debug for ParameterBlock<P, L, X, Penalty>
impl<P, L, X, Penalty> Debug for ParameterBlock<P, L, X, Penalty>
impl<P, L, X, Penalty> Eq for ParameterBlock<P, L, X, Penalty>
Source§impl<P, L, X, Penalty> PartialEq for ParameterBlock<P, L, X, Penalty>
impl<P, L, X, Penalty> PartialEq for ParameterBlock<P, L, X, Penalty>
Source§fn eq(&self, other: &ParameterBlock<P, L, X, Penalty>) -> bool
fn eq(&self, other: &ParameterBlock<P, L, X, Penalty>) -> bool
self and other values to be equal, and is used by ==.