pub struct RandomProjectionParams<Proj: ProjectionMethod, R: Rng + Clone>(/* private fields */);
Expand description
Random projection hyperparameters
The main hyperparameter of random projections is
the dimension of the embedding.
This dimension is usually determined by the desired precision (or distortion) eps
,
using the Johnson-Lindenstrauss Lemma.
However, this lemma makes a very conservative estimate of the required dimension,
and does not leverage the structure of the data, therefore it is also possible
to manually specify the dimension of the embedding.
As this algorithm is randomized, it also accepts an Rng
as parameter,
to be used to sample coordinate of the projection matrix.
Implementations§
Source§impl<Proj: ProjectionMethod, R: Rng + Clone> RandomProjectionParams<Proj, R>
impl<Proj: ProjectionMethod, R: Rng + Clone> RandomProjectionParams<Proj, R>
Sourcepub fn target_dim(self, dim: usize) -> Self
pub fn target_dim(self, dim: usize) -> Self
Set the dimension of output of the embedding.
Setting the target dimension with this function discards the precision parameter if it had been set previously.
Sourcepub fn eps(self, eps: f64) -> Self
pub fn eps(self, eps: f64) -> Self
Set the precision parameter (distortion, eps
) of the embedding.
Setting eps
with this function
discards the target dimension parameter if it had been set previously.
Sourcepub fn with_rng<R2: Rng + Clone>(
self,
rng: R2,
) -> RandomProjectionParams<Proj, R2>
pub fn with_rng<R2: Rng + Clone>( self, rng: R2, ) -> RandomProjectionParams<Proj, R2>
Specify the random number generator to use to generate the projection matrix.
Trait Implementations§
Source§impl<Proj: ProjectionMethod, R: Rng + Clone> ParamGuard for RandomProjectionParams<Proj, R>
impl<Proj: ProjectionMethod, R: Rng + Clone> ParamGuard for RandomProjectionParams<Proj, R>
Source§type Checked = RandomProjectionValidParams<Proj, R>
type Checked = RandomProjectionValidParams<Proj, R>
Source§type Error = ReductionError
type Error = ReductionError
Source§fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
Source§fn check(self) -> Result<Self::Checked, Self::Error>
fn check(self) -> Result<Self::Checked, Self::Error>
Source§fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
check()
and unwraps the resultAuto Trait Implementations§
impl<Proj, R> Freeze for RandomProjectionParams<Proj, R>where
R: Freeze,
impl<Proj, R> RefUnwindSafe for RandomProjectionParams<Proj, R>where
R: RefUnwindSafe,
Proj: RefUnwindSafe,
impl<Proj, R> Send for RandomProjectionParams<Proj, R>
impl<Proj, R> Sync for RandomProjectionParams<Proj, R>
impl<Proj, R> Unpin for RandomProjectionParams<Proj, R>
impl<Proj, R> UnwindSafe for RandomProjectionParams<Proj, R>where
R: UnwindSafe,
Proj: 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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.