[][src]Struct linfa_svm::solver_smo::SolverState

pub struct SolverState<'a, A: Float, K: Permutable<'a, A>> { /* fields omitted */ }

Current state of the SMO solver

We are solving the dual problem with linear constraints min_a f(a), s.t. y^Ta = d, 0 <= a_t < C, t = 1, ..., l where f(a) = a^T Q a / 2 + p^T a

Implementations

impl<'a, A: Float, K: 'a + Permutable<'a, A>> SolverState<'a, A, K>[src]

pub fn new(
    alpha: Vec<A>,
    p: Vec<A>,
    targets: Vec<bool>,
    kernel: K,
    bounds: Vec<A>,
    params: SolverParams<A>,
    nu_constraint: bool
) -> SolverState<'a, A, K>
[src]

Initialize a solver state

This is bounded by the lifetime of the kernel matrix, because it can quite large

pub fn nactive(&self) -> usize[src]

Return number of active variables

pub fn ntotal(&self) -> usize[src]

Return number of total variables

pub fn target(&self, idx: usize) -> A[src]

Return target as positive/negative indicator

pub fn bound(&self, idx: usize) -> A[src]

Return the k-th bound

pub fn swap(&mut self, i: usize, j: usize)[src]

Swap two variables

pub fn update(&mut self, working_set: (usize, usize))[src]

pub fn max_violating_pair(&self) -> ((A, isize), (A, isize))[src]

Return max and min gradients of free variables

pub fn max_violating_pair_nu(
    &self
) -> ((A, isize), (A, isize), (A, isize), (A, isize))
[src]

pub fn select_working_set(&self) -> (usize, usize, bool)[src]

Select optimal working set

In each optimization step two variables are selected and then optimized. The indices are selected such that:

  • i: maximizes -y_i * grad(f)_i, i in I_up(\alpha)
  • j: minimizes the decrease of the objective value

pub fn select_working_set_nu(&self) -> (usize, usize, bool)[src]

Select optimal working set

In each optimization step two variables are selected and then optimized. The indices are selected such that:

  • i: maximizes -y_i * grad(f)_i, i in I_up(\alpha)
  • j: minimizes the decrease of the objective value

pub fn should_shrunk(&self, i: usize, gmax1: A, gmax2: A) -> bool[src]

pub fn should_shrunk_nu(
    &self,
    i: usize,
    gmax1: A,
    gmax2: A,
    gmax3: A,
    gmax4: A
) -> bool
[src]

pub fn do_shrinking(&mut self)[src]

pub fn do_shrinking_nu(&mut self)[src]

pub fn calculate_rho(&mut self) -> A[src]

pub fn calculate_rho_nu(&mut self) -> A[src]

pub fn solve(self) -> Svm<'a, A, A>[src]

Auto Trait Implementations

impl<'a, A, K> RefUnwindSafe for SolverState<'a, A, K> where
    A: RefUnwindSafe,
    K: RefUnwindSafe

impl<'a, A, K> Send for SolverState<'a, A, K> where
    K: Send + Sync

impl<'a, A, K> Sync for SolverState<'a, A, K> where
    K: Sync

impl<'a, A, K> Unpin for SolverState<'a, A, K> where
    A: Unpin,
    K: Unpin

impl<'a, A, K> UnwindSafe for SolverState<'a, A, K> where
    A: UnwindSafe,
    K: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,