pub fn weighted_sum<D: Data<Elem = F>>(&self, sample: &ArrayBase<D, Ix1>) -> F {
        match self.sep_hyperplane {
            SeparatingHyperplane::Linear(ref x) => x.mul(sample).sum(),
            SeparatingHyperplane::WeightedCombination(ref supp_vecs) => supp_vecs
                .outer_iter()
                .zip(
                    self.alpha
                        .iter()
                        .filter(|a| a.abs() > F::cast(100.) * F::epsilon()),
                )
                .map(|(x, a)| self.kernel_method.distance(x, sample.view()) * *a)
                .sum(),
        }
    }
/// Sums the inner product of `sample` and every one of the support vectors.
///
/// ## Parameters
///
/// * `sample`: the input sample
///
/// ## Returns
///
/// The sum of all inner products of `sample` and every one of the support vectors, scaled by their weight.
///
/// ## Panics
///
/// If the shape of `sample` is not compatible with the
/// shape of the support vectors
Sums the inner product of `sample` and every one of the support vectors.
Sums the inner product of ` sample ` and every one of the support vectors .
pub fn weighted_sum<D: Data<Elem = F>>(&self, sample: &ArrayBase<D, Ix1>) -> F {
        match self.sep_hyperplane {
            SeparatingHyperplane::Linear(ref x) => x.mul(sample).sum(),
            SeparatingHyperplane::WeightedCombination(ref supp_vecs) => supp_vecs
                .outer_iter()
                .zip(
                    self.alpha
                        .iter()
                        .filter(|a| a.abs() > F::cast(100.) * F::epsilon()),
                )
                .map(|(x, a)| self.kernel_method.distance(x, sample.view()) * *a)
                .sum(),
        }
    }
pub fn weighted_sum < D : Data < Elem = F > > ( & self , sample : & ArrayBase < D , Ix1 > ) -> F { match self . sep_hyperplane { SeparatingHyperplane :: Linear ( ref x ) => x . mul ( sample ) . sum ( ) , SeparatingHyperplane :: WeightedCombination ( ref supp_vecs ) => supp_vecs . outer_iter ( ) . zip ( self . alpha . iter ( ) . filter ( | a | a . abs ( ) > F :: cast ( 100. ) * F :: epsilon ( ) ) , ) . map ( | ( x , a ) | self . kernel_method . distance ( x , sample . view ( ) ) * * a ) . sum ( ) , } }
Sums the inner product of `sample` and every one of the support vectors.
Sums the inner product of ` sample ` and every one of the support vectors .
&self
sample
&ArrayBase<D, Ix1>
The sum of all inner products of `sample` and every one of the support vectors, scaled by their weight.
The sum of all inner products of ` sample ` and every one of the support vectors scaled by their weight .
&self
sample
&ArrayBase<D, Ix1>
panics
If the shape of `sample` is not compatible with the
shape of the support vectors
If the shape of ` sample ` is not compatible with the shape of the support vectors