pub struct DeepKernelBuilder { /* private fields */ }Expand description
Fluent builder for Deep Kernel networks.
The builder records layer widths and activations in order. The first
width is the input dimension (set via Self::input_dim). Every
subsequent hidden layer appends a new width and its activation. The
terminating Self::output_dim records the final width and the
output-layer activation.
Implementations§
Source§impl DeepKernelBuilder
impl DeepKernelBuilder
Sourcepub fn input_dim(self, dim: usize) -> Self
pub fn input_dim(self, dim: usize) -> Self
Set the input dimension. Must be called exactly once before the first hidden or output layer.
Append a hidden layer with the given width and activation.
Ignored if the builder has already been closed with
Self::output_dim — the builder reports that as an error at
build time via
KernelError::InvalidParameter.
Sourcepub fn output_dim(self, width: usize, activation: Activation) -> Self
pub fn output_dim(self, width: usize, activation: Activation) -> Self
Finalise the topology by appending the output layer. Must be called exactly once.
Sourcepub fn build_extractor(&self) -> Result<MLPFeatureExtractor>
pub fn build_extractor(&self) -> Result<MLPFeatureExtractor>
Produce an owned MLPFeatureExtractor for the configured
topology, without a base kernel. Useful when the caller wants to
combine the MLP with a kernel that needs additional plumbing.
Sourcepub fn build<K: Kernel>(
self,
base: K,
) -> Result<DeepKernel<MLPFeatureExtractor, K>>
pub fn build<K: Kernel>( self, base: K, ) -> Result<DeepKernel<MLPFeatureExtractor, K>>
Finalise the builder against a base kernel and produce a fully
wired DeepKernel.
Trait Implementations§
Source§impl Clone for DeepKernelBuilder
impl Clone for DeepKernelBuilder
Source§fn clone(&self) -> DeepKernelBuilder
fn clone(&self) -> DeepKernelBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeepKernelBuilder
impl Debug for DeepKernelBuilder
Source§impl Default for DeepKernelBuilder
impl Default for DeepKernelBuilder
Source§fn default() -> DeepKernelBuilder
fn default() -> DeepKernelBuilder
Auto Trait Implementations§
impl Freeze for DeepKernelBuilder
impl RefUnwindSafe for DeepKernelBuilder
impl Send for DeepKernelBuilder
impl Sync for DeepKernelBuilder
impl Unpin for DeepKernelBuilder
impl UnsafeUnpin for DeepKernelBuilder
impl UnwindSafe for DeepKernelBuilder
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> 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>
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 more