pub struct ParamsBase<S = OwnedRepr<f64>, D = Ix2, K = Biased>{ /* private fields */ }Expand description
The ParamsBase struct is a generic store for linear parameters. The store mimics
the underlying ArrayBase, enabling developers to specify
the data repr and dimension. Additionally, the store is parameterized to
accept a K type, used to designate the store as either Biased or Unbiased.
Implementations§
Source§impl<A, S, D, K> ParamsBase<S, D, K>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D, K> ParamsBase<S, D, K>where
D: RemoveAxis,
S: RawData<Elem = A>,
pub fn from_elem<Sh>(shape: Sh, elem: A) -> Self
pub fn into_biased(self) -> ParamsBase<S, D, Biased>
pub fn into_unbiased(self) -> ParamsBase<S, D, Unbiased>
pub const fn weights(&self) -> &ArrayBase<S, D>
pub fn weights_mut(&mut self) -> &mut ArrayBase<S, D>
pub fn features(&self) -> Features
pub fn in_features(&self) -> usize
pub fn out_features(&self) -> usize
pub fn new<Sh>(shape: Sh) -> Self
pub fn ones<Sh>(shape: Sh) -> Self
pub fn zeros<Sh>(shape: Sh) -> Self
pub fn into_owned(self) -> ParamsBase<OwnedRepr<A>, D, K>
pub fn to_owned(&self) -> ParamsBase<OwnedRepr<A>, D, K>
pub fn view(&self) -> ParamsBase<ViewRepr<&A>, D, K>
pub fn view_mut(&mut self) -> ParamsBase<ViewRepr<&mut A>, D, K>
Source§impl<A, S, D> ParamsBase<S, D, Biased>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D> ParamsBase<S, D, Biased>where
D: RemoveAxis,
S: RawData<Elem = A>,
Source§impl<A, S, D> ParamsBase<S, D, Unbiased>
impl<A, S, D> ParamsBase<S, D, Unbiased>
Source§impl<A, S, K> ParamsBase<S, Ix2, K>where
K: 'static,
S: RawData<Elem = A>,
impl<A, S, K> ParamsBase<S, Ix2, K>where
K: 'static,
S: RawData<Elem = A>,
Source§impl<A, S, D, K> ParamsBase<S, D, K>where
A: Clone + Float + SampleUniform,
D: RemoveAxis,
K: ParamMode,
S: RawData<Elem = A>,
StandardNormal: Distribution<A>,
<A as SampleUniform>::Sampler: Clone,
impl<A, S, D, K> ParamsBase<S, D, K>where
A: Clone + Float + SampleUniform,
D: RemoveAxis,
K: ParamMode,
S: RawData<Elem = A>,
StandardNormal: Distribution<A>,
<A as SampleUniform>::Sampler: Clone,
pub fn uniform(self) -> LinearParams<A, K, D>where
S: DataOwned,
pub fn uniform_between(self, low: A, high: A) -> LinearParams<A, K, D>where
S: DataOwned,
Trait Implementations§
Source§impl<A, S, D, K> Borrow<ParamsBase<S, D, K>> for Linear<A, K, D, S>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D, K> Borrow<ParamsBase<S, D, K>> for Linear<A, K, D, S>where
D: RemoveAxis,
S: RawData<Elem = A>,
Source§fn borrow(&self) -> &ParamsBase<S, D, K>
fn borrow(&self) -> &ParamsBase<S, D, K>
Immutably borrows from an owned value. Read more
Source§impl<A, S, D, K> BorrowMut<ParamsBase<S, D, K>> for Linear<A, K, D, S>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D, K> BorrowMut<ParamsBase<S, D, K>> for Linear<A, K, D, S>where
D: RemoveAxis,
S: RawData<Elem = A>,
Source§fn borrow_mut(&mut self) -> &mut ParamsBase<S, D, K>
fn borrow_mut(&mut self) -> &mut ParamsBase<S, D, K>
Mutably borrows from an owned value. Read more
Source§impl<A, S, D> Clone for ParamsBase<S, D>
impl<A, S, D> Clone for ParamsBase<S, D>
Source§impl<A, S, D> Default for ParamsBase<S, D, Biased>
impl<A, S, D> Default for ParamsBase<S, D, Biased>
Source§impl<A, S, D> Default for ParamsBase<S, D, Unbiased>
impl<A, S, D> Default for ParamsBase<S, D, Unbiased>
Source§impl<'a, A, S, D, K> Deserialize<'a> for ParamsBase<S, D, K>where
A: Deserialize<'a>,
D: Deserialize<'a> + RemoveAxis,
S: DataOwned<Elem = A>,
<D as Dimension>::Smaller: Deserialize<'a> + Dimension,
impl<'a, A, S, D, K> Deserialize<'a> for ParamsBase<S, D, K>where
A: Deserialize<'a>,
D: Deserialize<'a> + RemoveAxis,
S: DataOwned<Elem = A>,
<D as Dimension>::Smaller: Deserialize<'a> + Dimension,
Source§fn deserialize<Der>(deserializer: Der) -> Result<Self, Der::Error>where
Der: Deserializer<'a>,
fn deserialize<Der>(deserializer: Der) -> Result<Self, Der::Error>where
Der: Deserializer<'a>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<A> From<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, A)> for ParamsBase<OwnedRepr<A>, Ix1, Biased>where
A: Clone,
impl<A> From<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, A)> for ParamsBase<OwnedRepr<A>, Ix1, Biased>where
A: Clone,
Source§impl<A, K> From<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<A>)> for ParamsBase<OwnedRepr<A>, Ix1, K>where
A: Clone,
impl<A, K> From<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<A>)> for ParamsBase<OwnedRepr<A>, Ix1, K>where
A: Clone,
Source§impl<A, S, D> From<(ArrayBase<S, D>, ArrayBase<S, <D as Dimension>::Smaller>)> for ParamsBase<S, D, Biased>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D> From<(ArrayBase<S, D>, ArrayBase<S, <D as Dimension>::Smaller>)> for ParamsBase<S, D, Biased>where
D: RemoveAxis,
S: RawData<Elem = A>,
Source§impl<A, S, D, K> From<(ArrayBase<S, D>, Option<ArrayBase<S, <D as Dimension>::Smaller>>)> for ParamsBase<S, D, K>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D, K> From<(ArrayBase<S, D>, Option<ArrayBase<S, <D as Dimension>::Smaller>>)> for ParamsBase<S, D, K>where
D: RemoveAxis,
S: RawData<Elem = A>,
Source§impl<A, S> FromIterator<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<ArrayBase<OwnedRepr<A>, Dim<[usize; 0]>>>)> for ParamsBase<S, Ix2>
impl<A, S> FromIterator<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<ArrayBase<OwnedRepr<A>, Dim<[usize; 0]>>>)> for ParamsBase<S, Ix2>
Source§impl<A, S, D, K> Initialize<A, D> for ParamsBase<S, D, K>
impl<A, S, D, K> Initialize<A, D> for ParamsBase<S, D, K>
type Data = S
Source§fn rand<Sh, Dstr>(shape: Sh, distr: Dstr) -> Self
fn rand<Sh, Dstr>(shape: Sh, distr: Dstr) -> Self
Generate a random array using the given distribution
Source§fn rand_with<Sh, Ds, R>(shape: Sh, distr: Ds, rng: &mut R) -> Self
fn rand_with<Sh, Ds, R>(shape: Sh, distr: Ds, rng: &mut R) -> Self
Generate a random array using the given distribution and random number generator
Source§fn init_rand<Ds>(self, distr: Ds) -> Self
fn init_rand<Ds>(self, distr: Ds) -> Self
Initialize an array with random values using the given distribution and current shape
Source§fn init_rand_with<Ds, R>(self, distr: Ds, rng: &mut R) -> Self
fn init_rand_with<Ds, R>(self, distr: Ds, rng: &mut R) -> Self
Initialize an array with random values from the current shape using the given distribution and random number generator
Source§impl<A, S, D, E> IntoIterator for ParamsBase<S, D, Biased>
impl<A, S, D, E> IntoIterator for ParamsBase<S, D, Biased>
Source§impl<A, S, D, E> IntoIterator for ParamsBase<S, D, Unbiased>
impl<A, S, D, E> IntoIterator for ParamsBase<S, D, Unbiased>
Source§type IntoIter = IntoIter<<ParamsBase<S, D, Unbiased> as IntoIterator>::Item>
type IntoIter = IntoIter<<ParamsBase<S, D, Unbiased> as IntoIterator>::Item>
Which kind of iterator are we turning this into?
Source§impl<A, S, D, K> PartialEq<(ArrayBase<S, D>, ArrayBase<S, <D as Dimension>::Smaller>)> for ParamsBase<S, D, K>
impl<A, S, D, K> PartialEq<(ArrayBase<S, D>, ArrayBase<S, <D as Dimension>::Smaller>)> for ParamsBase<S, D, K>
Source§impl<A, S, D, K> PartialEq<(ArrayBase<S, D>, Option<ArrayBase<S, <D as Dimension>::Smaller>>)> for ParamsBase<S, D, K>
impl<A, S, D, K> PartialEq<(ArrayBase<S, D>, Option<ArrayBase<S, <D as Dimension>::Smaller>>)> for ParamsBase<S, D, K>
Source§impl<A, S, D> PartialEq for ParamsBase<S, D>
impl<A, S, D> PartialEq for ParamsBase<S, D>
Source§impl<'a, A, B, T, S, D, K> Predict<A> for &'a ParamsBase<S, D, K>where
A: Dot<Array<T, D>, Output = B>,
B: Add<&'a ArrayBase<S, D::Smaller>, Output = B>,
D: RemoveAxis,
S: Data<Elem = T>,
T: ComplexFloat,
impl<'a, A, B, T, S, D, K> Predict<A> for &'a ParamsBase<S, D, K>where
A: Dot<Array<T, D>, Output = B>,
B: Add<&'a ArrayBase<S, D::Smaller>, Output = B>,
D: RemoveAxis,
S: Data<Elem = T>,
T: ComplexFloat,
Source§impl<A, B, T, S, D, K> Predict<A> for ParamsBase<S, D, K>where
A: Dot<Array<T, D>, Output = B>,
B: for<'a> Add<&'a ArrayBase<S, D::Smaller>, Output = B>,
D: RemoveAxis,
S: Data<Elem = T>,
T: ComplexFloat,
impl<A, B, T, S, D, K> Predict<A> for ParamsBase<S, D, K>where
A: Dot<Array<T, D>, Output = B>,
B: for<'a> Add<&'a ArrayBase<S, D::Smaller>, Output = B>,
D: RemoveAxis,
S: Data<Elem = T>,
T: ComplexFloat,
Source§impl<A, S, D, K> Serialize for ParamsBase<S, D, K>
impl<A, S, D, K> Serialize for ParamsBase<S, D, K>
impl<A, S, D> Copy for ParamsBase<S, D>where
A: Copy,
D: Copy + RemoveAxis,
S: Copy + RawDataClone<Elem = A>,
<D as Dimension>::Smaller: Copy,
Auto Trait Implementations§
impl<S, D, K> Freeze for ParamsBase<S, D, K>
impl<S, D, K> RefUnwindSafe for ParamsBase<S, D, K>where
S: RefUnwindSafe,
D: RefUnwindSafe,
K: RefUnwindSafe,
<D as Dimension>::Smaller: RefUnwindSafe,
<S as RawData>::Elem: RefUnwindSafe,
impl<S, D, K> Send for ParamsBase<S, D, K>
impl<S, D, K> Sync for ParamsBase<S, D, K>
impl<S, D, K> Unpin for ParamsBase<S, D, K>
impl<S, D, K> UnwindSafe for ParamsBase<S, D, K>where
S: UnwindSafe,
D: UnwindSafe,
K: UnwindSafe,
<D as Dimension>::Smaller: UnwindSafe,
<S as RawData>::Elem: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I, M, T> ForwardIter<T> for I
impl<I, M, T> ForwardIter<T> for I
Source§impl<K, S> Id<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Id<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<U, A, S, D> InitializeExt<A, S, D> for U
impl<U, A, S, D> InitializeExt<A, S, D> for U
fn bernoulli<Sh>(shape: Sh, p: f64) -> Result<Self, BernoulliError>
Source§fn lecun_normal<Sh>(shape: Sh, n: usize) -> Self
fn lecun_normal<Sh>(shape: Sh, n: usize) -> Self
Initialize the object according to the Lecun Initialization scheme.
LecunNormal distributions are truncated Normal
distributions centered at 0 with a standard deviation equal to the
square root of the reciprocal of the number of inputs.
Source§fn normal<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, Error>
fn normal<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, Error>
Given a shape, mean, and standard deviation generate a new object using the Normal distribution
fn randc<Sh>(shape: Sh, re: A, im: A) -> Self
Source§fn stdnorm<Sh>(shape: Sh) -> Self
fn stdnorm<Sh>(shape: Sh) -> Self
Generate a random array using the StandardNormal distribution
Source§fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
Generate a random array using the StandardNormal distribution with a given seed
Source§fn truncnorm<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, Error>
fn truncnorm<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, Error>
Initialize the object using the TruncatedNormal distribution
Source§fn uniform<Sh>(shape: Sh, dk: A) -> Selfwhere
A: Neg<Output = A> + SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
fn uniform<Sh>(shape: Sh, dk: A) -> Selfwhere
A: Neg<Output = A> + SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
A uniform generator with values between u(-dk, dk)
fn uniform_from_seed<Sh>(shape: Sh, start: A, stop: A, key: u64) -> Selfwhere
A: SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Source§fn uniform_along<Sh>(shape: Sh, axis: usize) -> Selfwhere
A: Copy + Float + SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
fn uniform_along<Sh>(shape: Sh, axis: usize) -> Selfwhere
A: Copy + Float + SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Generate a random array with values between u(-a, a) where a is the reciprocal of the value at the given axis
Source§fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Selfwhere
A: SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Selfwhere
A: SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
A uniform generator with values between u(-dk, dk)