[−][src]Struct lfa::basis::fixed::Polynomial
Polynomial basis projector.
Linear regression on the interval [0, 1]
use lfa::basis::{Projector, fixed::Polynomial}; let p = Polynomial::new(1, vec![(0.0, 1.0)]); assert_eq!(p.project(&vec![0.00]), vec![-1.0].into()); assert_eq!(p.project(&vec![0.25]), vec![-0.5].into()); assert_eq!(p.project(&vec![0.50]), vec![0.0].into()); assert_eq!(p.project(&vec![0.75]), vec![0.5].into()); assert_eq!(p.project(&vec![1.00]), vec![1.0].into());
Quadratic regression on the interval [0, 1]
use lfa::basis::{Projector, fixed::Polynomial}; let p = Polynomial::new(2, vec![(0.0, 1.0)]); assert_eq!(p.project(&vec![0.00]), vec![-1.0, 1.0].into()); assert_eq!(p.project(&vec![0.25]), vec![-0.5, 0.25].into()); assert_eq!(p.project(&vec![0.50]), vec![0.0, 0.0].into()); assert_eq!(p.project(&vec![0.75]), vec![0.5, 0.25].into()); assert_eq!(p.project(&vec![1.00]), vec![1.0, 1.0].into());
Fields
order: u8
limits: Vec<(f64, f64)>
exponents: Vec<Vec<i32>>
Methods
impl Polynomial
[src]
pub fn new(order: u8, limits: Vec<(f64, f64)>) -> Self
[src]
pub fn from_space(order: u8, input_space: LinearSpace<Interval>) -> Self
[src]
Trait Implementations
impl Projector<[f64]> for Polynomial
[src]
fn project(&self, input: &[f64]) -> Projection
[src]
fn project_expanded(&self, input: &I) -> DenseT
[src]
Project data from an input space onto the basis and expand into a dense vector form using Projection::expanded(self.dim())
. Read more
impl Projector<Vec<f64>> for Polynomial where
Polynomial: Projector<[f64]>,
[src]
Polynomial: Projector<[f64]>,
fn project(&self, input: &Vec<f64>) -> Projection
[src]
fn project_expanded(&self, input: &I) -> DenseT
[src]
Project data from an input space onto the basis and expand into a dense vector form using Projection::expanded(self.dim())
. Read more
impl Projector<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for Polynomial where
Polynomial: Projector<[f64]>,
[src]
Polynomial: Projector<[f64]>,
fn project(&self, input: &Vector<f64>) -> Projection
[src]
fn project_expanded(&self, input: &I) -> DenseT
[src]
Project data from an input space onto the basis and expand into a dense vector form using Projection::expanded(self.dim())
. Read more
impl Composable for Polynomial
[src]
fn lfa<A: Approximator<Projection>>(self, approximator: A) -> LFA<Self, A>
[src]
Return an LFA
using this Projector
instance and a given Approximator
.
fn stack<P>(self, p: P) -> Stack<Self, P>
[src]
Return a Stack
of this Projector
over another.
fn add<P: Space>(self, p: P) -> Sum<Self, P> where
Self: Space,
[src]
Self: Space,
Return the Sum
of this Projector
and another.
fn subtract<P: Space>(self, p: P) -> Sum<Self, Negate<P>> where
Self: Space,
[src]
Self: Space,
Return the Sum
of this Projector
and the Negate
d other.
fn shift(self, offset: f64) -> Shift<Self>
[src]
Return the original Projector
with all activations Shift
ed by some offset
.
fn multiply<P: Space>(self, p: P) -> Product<Self, P> where
Self: Space,
[src]
Self: Space,
Return the Product
of this Projector
and another.
fn divide<P: Space>(self, p: P) -> Product<Self, Reciprocal<P>> where
Self: Space,
[src]
Self: Space,
Return the Product
of this Projector
and the Reciprocal
of the other.
fn scale(self, factor: f64) -> Scale<Self>
[src]
Return the original Projector
with all activations Scale
d by some factor
.
fn normalise_l1(self) -> L1Normalise<Self>
[src]
Return the original Projector
with all activations normalised in L₁.
fn normalise_l2(self) -> L2Normalise<Self>
[src]
Return the original Projector
with all activations normalised in L₂.
fn normalise_lp(self, p: u8) -> LpNormalise<Self>
[src]
Return the original Projector
with all activations normalised in Lp.
fn normalise_linf(self) -> LinfNormalise<Self>
[src]
Return the original Projector
with all activations normalised in L∞.
fn with_constant(self) -> Stack<Self, Constant>
[src]
Return the a Stack
of this Projector
with a single constant feature term.
impl Clone for Polynomial
[src]
fn clone(&self) -> Polynomial
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Polynomial
[src]
impl<'de> Deserialize<'de> for Polynomial
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Polynomial
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl Space for Polynomial
[src]
Auto Trait Implementations
impl Send for Polynomial
impl Sync for Polynomial
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,