Struct smartcore::neighbors::knn_regressor::KNNRegressorParameters
source · pub struct KNNRegressorParameters<T: Number, D: Distance<Vec<T>>> {
pub algorithm: KNNAlgorithmName,
pub weight: KNNWeightFunction,
pub k: usize,
/* private fields */
}
Expand description
KNNRegressor
parameters. Use Default::default()
for default values.
Fields§
§algorithm: KNNAlgorithmName
backend search algorithm. See knn search algorithms
. CoverTree
is default.
weight: KNNWeightFunction
weighting function that is used to calculate estimated class value. Default function is KNNWeightFunction::Uniform
.
k: usize
number of training samples to consider when estimating class for new point. Default value is 3.
Implementations§
source§impl<T: Number, D: Distance<Vec<T>>> KNNRegressorParameters<T, D>
impl<T: Number, D: Distance<Vec<T>>> KNNRegressorParameters<T, D>
sourcepub fn with_k(self, k: usize) -> Self
pub fn with_k(self, k: usize) -> Self
number of training samples to consider when estimating class for new point. Default value is 3.
sourcepub fn with_distance<DD: Distance<Vec<T>>>(
self,
distance: DD
) -> KNNRegressorParameters<T, DD>
pub fn with_distance<DD: Distance<Vec<T>>>( self, distance: DD ) -> KNNRegressorParameters<T, DD>
sourcepub fn with_algorithm(self, algorithm: KNNAlgorithmName) -> Self
pub fn with_algorithm(self, algorithm: KNNAlgorithmName) -> Self
backend search algorithm. See knn search algorithms
. CoverTree
is default.
sourcepub fn with_weight(self, weight: KNNWeightFunction) -> Self
pub fn with_weight(self, weight: KNNWeightFunction) -> Self
weighting function that is used to calculate estimated class value. Default function is KNNWeightFunction::Uniform
.
Trait Implementations§
source§impl<T: Clone + Number, D: Clone + Distance<Vec<T>>> Clone for KNNRegressorParameters<T, D>
impl<T: Clone + Number, D: Clone + Distance<Vec<T>>> Clone for KNNRegressorParameters<T, D>
source§fn clone(&self) -> KNNRegressorParameters<T, D>
fn clone(&self) -> KNNRegressorParameters<T, D>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<TX: Number, TY: Number, X: Array2<TX>, Y: Array1<TY>, D: Distance<Vec<TX>>> SupervisedEstimator<X, Y, KNNRegressorParameters<TX, D>> for KNNRegressor<TX, TY, X, Y, D>
impl<TX: Number, TY: Number, X: Array2<TX>, Y: Array1<TY>, D: Distance<Vec<TX>>> SupervisedEstimator<X, Y, KNNRegressorParameters<TX, D>> for KNNRegressor<TX, TY, X, Y, D>
Auto Trait Implementations§
impl<T, D> RefUnwindSafe for KNNRegressorParameters<T, D>where D: RefUnwindSafe, T: RefUnwindSafe,
impl<T, D> Send for KNNRegressorParameters<T, D>where D: Send, T: Send,
impl<T, D> Sync for KNNRegressorParameters<T, D>where D: Sync, T: Sync,
impl<T, D> Unpin for KNNRegressorParameters<T, D>where D: Unpin, T: Unpin,
impl<T, D> UnwindSafe for KNNRegressorParameters<T, D>where D: UnwindSafe, T: UnwindSafe,
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