pub struct DKLConfig {
pub feature_layers: Vec<usize>,
pub n_components: usize,
pub activation: Activation,
pub gamma: Float,
pub learning_rate: Float,
}Expand description
Deep Kernel Learning combines deep neural networks with kernel methods
This approach uses a deep neural network to learn a feature representation, then applies a kernel method in the learned feature space.
§Mathematical Background
Deep Kernel Learning defines a composite kernel: k(x, x’) = k_base(φ(x; θ), φ(x’; θ)) where:
- φ(·; θ) is a deep neural network with parameters θ
- k_base is a base kernel (e.g., RBF)
§Examples
ⓘ
use sklears_kernel_approximation::deep_learning_kernels::{DeepKernelLearning, DKLConfig};
use scirs2_core::ndarray::array;
use sklears_core::traits::{Fit, Transform};
let config = DKLConfig {
feature_layers: vec![10, 20, 10],
n_components: 50,
..Default::default()
};
let dkl = DeepKernelLearning::new(config);
let X = array![[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]];
let fitted = dkl.fit(&X, &()).unwrap();
let features = fitted.transform(&X).unwrap();
assert_eq!(features.shape(), &[3, 50]);Fields§
§feature_layers: Vec<usize>Sizes of feature extraction layers
n_components: usizeNumber of random Fourier features for final kernel
activation: ActivationActivation function for feature layers
gamma: FloatBandwidth for final RBF kernel
learning_rate: FloatLearning rate for feature learning (currently not trainable, uses random features)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DKLConfig
impl<'de> Deserialize<'de> for DKLConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DKLConfig
impl RefUnwindSafe for DKLConfig
impl Send for DKLConfig
impl Sync for DKLConfig
impl Unpin for DKLConfig
impl UnwindSafe for DKLConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more