pub struct Dgrdl<T> { /* private fields */ }Expand description
Main DGRDL implementation
Implements the Dual Graph Regularized Dictionary Learning algorithm which learns a sparse dictionary representation while preserving local geometric structure in both sample and feature spaces through graph regularization.
§Fields
params- Configuration parameters for the algorithm
Implementations§
Source§impl<T: BixverseFloat> Dgrdl<T>
impl<T: BixverseFloat> Dgrdl<T>
Sourcepub fn new(params: DgrdlParams<T>) -> Self
pub fn new(params: DgrdlParams<T>) -> Self
Sourcepub fn fit(
&mut self,
data: &MatRef<'_, T>,
seed: usize,
verbose: bool,
) -> DgrdlResults<T>
pub fn fit( &mut self, data: &MatRef<'_, T>, seed: usize, verbose: bool, ) -> DgrdlResults<T>
Run DGRDL algorithm on input data (with initial hyper parameters)
Implements the main optimization loop alternating between sparse coding and dictionary update steps. The algorithm minimizes: ||Y - DX||²_F + α·tr(D^T·D·L_s) + β·tr(X·L_f·X^T) + sparsity constraint where Y is data, D is dictionary, X is coefficients, L_s and L_f are sample and feature Laplacians respectively.
§Params
data- Input data matrix of size n_samples × n_featuresseed- Seed for dictionary initialisation.verbose- Whether to print iteration progress
§Returns
DgrdlResults containing the learned dictionary, coefficients, and Laplacians
Sourcepub fn fit_with_params(
&mut self,
data: &MatRef<'_, T>,
params: DgrdlParams<T>,
seed: usize,
verbose: bool,
) -> DgrdlResults<T>
pub fn fit_with_params( &mut self, data: &MatRef<'_, T>, params: DgrdlParams<T>, seed: usize, verbose: bool, ) -> DgrdlResults<T>
Run DGRDL algorithm on input data (with provided hyperparameters)
Implements the main optimization loop alternating between sparse coding and dictionary update steps. The algorithm minimizes: ||Y - DX||²_F + α·tr(D^T·D·L_s) + β·tr(X·L_f·X^T) + sparsity constraint where Y is data, D is dictionary, X is coefficients, L_s and L_f are sample and feature Laplacians respectively.
§Params
data- Input data matrix of size n_samples × n_featuresparams- TheDgrdlParamscontaining the parameters you wish to use.seed- Seed for dictionary initialisation.verbose- Whether to print iteration progress
§Returns
DgrdlResults containing the learned dictionary, coefficients, and
Laplacians
Sourcepub fn grid_search(
&mut self,
data: &MatRef<'_, T>,
dict_sizes: &[usize],
k_neighbours_iters: &[usize],
seeds: &[usize],
verbose: bool,
) -> Vec<DgrdlObjectives<T>>
pub fn grid_search( &mut self, data: &MatRef<'_, T>, dict_sizes: &[usize], k_neighbours_iters: &[usize], seeds: &[usize], verbose: bool, ) -> Vec<DgrdlObjectives<T>>
Run a hyperparameter search over DGRDL
Helper function to sweep over a set of hyperparameters and return different objectives from the algorithm for subsequent visualisation.
§Params
data- Input data matrix of size n_samples × n_featuresdict_sizes- Slice of different dictionary sizes you wish to test for.k_neighbours_iters- Slice of different k neighbours to iterate over.seeds- Slice of random initialisations to test.verbose- Controls verbosity of the function
§Returns
DgrdlResults containing the learned dictionary, coefficients, and
Laplacians
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Dgrdl<T>
impl<T> RefUnwindSafe for Dgrdl<T>
impl<T> Send for Dgrdl<T>
impl<T> Sync for Dgrdl<T>
impl<T> Unpin for Dgrdl<T>
impl<T> UnsafeUnpin for Dgrdl<T>
impl<T> UnwindSafe for Dgrdl<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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§fn to_subset_unchecked(&self) -> SS
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.