pub struct IsotonicRegression {}Expand description
An isotonic regression model.
IsotonicRegression solves an isotonic regression problem using the pool adjacent violators algorithm.
§Examples
Here’s an example on how to train an isotonic regression model on
the first feature from the diabetes dataset.
use linfa::{traits::Fit, traits::Predict, Dataset};
use linfa_linear::IsotonicRegression;
use linfa::prelude::SingleTargetRegression;
let diabetes = linfa_datasets::diabetes();
let dataset = diabetes.feature_iter().next().unwrap(); // get first 1D feature
let model = IsotonicRegression::default().fit(&dataset).unwrap();
let pred = model.predict(&dataset);
let r2 = pred.r2(&dataset).unwrap();
println!("r2 from prediction: {}", r2);§References
Best, M.J., Chakravarti, N. Active set algorithms for isotonic regression; A unifying framework. Mathematical Programming 47, 425–439 (1990).
Implementations§
Source§impl IsotonicRegression
impl IsotonicRegression
Sourcepub fn new() -> IsotonicRegression
pub fn new() -> IsotonicRegression
Create a default isotonic regression model.
Trait Implementations§
Source§impl Clone for IsotonicRegression
impl Clone for IsotonicRegression
Source§fn clone(&self) -> IsotonicRegression
fn clone(&self) -> IsotonicRegression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IsotonicRegression
impl Debug for IsotonicRegression
Source§impl Default for IsotonicRegression
impl Default for IsotonicRegression
Source§fn default() -> IsotonicRegression
fn default() -> IsotonicRegression
Source§impl<F: Float, D: Data<Elem = F>, T: AsSingleTargets<Elem = F>> Fit<ArrayBase<D, Dim<[usize; 2]>>, T, LinearError<F>> for IsotonicRegression
impl<F: Float, D: Data<Elem = F>, T: AsSingleTargets<Elem = F>> Fit<ArrayBase<D, Dim<[usize; 2]>>, T, LinearError<F>> for IsotonicRegression
Source§fn fit(
&self,
dataset: &DatasetBase<ArrayBase<D, Ix2>, T>,
) -> Result<Self::Object, F>
fn fit( &self, dataset: &DatasetBase<ArrayBase<D, Ix2>, T>, ) -> Result<Self::Object, F>
Fit an isotonic regression model given a feature matrix X and a target
variable y.
The feature matrix X must have shape (n_samples, 1)
The target variable y must have shape (n_samples)
Returns a FittedIsotonicRegression object which contains the fitted
parameters and can be used to predict values of the target variable
for new feature values.
type Object = FittedIsotonicRegression<F>
Source§impl PartialEq for IsotonicRegression
impl PartialEq for IsotonicRegression
impl Eq for IsotonicRegression
impl StructuralPartialEq for IsotonicRegression
Auto Trait Implementations§
impl Freeze for IsotonicRegression
impl RefUnwindSafe for IsotonicRegression
impl Send for IsotonicRegression
impl Sync for IsotonicRegression
impl Unpin for IsotonicRegression
impl UnwindSafe for IsotonicRegression
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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