Skip to main content

TaskProbe

Trait TaskProbe 

Source
pub trait TaskProbe {
    // Required methods
    fn dimension(&self) -> usize;
    fn gradient_at(&self, params: &Array1<f64>) -> Array1<f64>;
    fn initial_params(&self) -> Array1<f64>;

    // Provided method
    fn gradient_sample(
        &self,
        params: &Array1<f64>,
        sample_index: usize,
    ) -> Array1<f64> { ... }
}
Expand description

A lightweight handle on an optimization task used for meta-feature extraction.

A probe exposes the problem dimensionality, a starting point, and a way to query the gradient at arbitrary points. Implementations should make TaskProbe::gradient_at cheap, since the extractor calls it a handful of times.

Required Methods§

Source

fn dimension(&self) -> usize

Dimensionality of the parameter vector.

Source

fn gradient_at(&self, params: &Array1<f64>) -> Array1<f64>

Gradient (or its expectation, for a stochastic oracle) at params.

Source

fn initial_params(&self) -> Array1<f64>

A representative initial parameter vector for the task.

Provided Methods§

Source

fn gradient_sample( &self, params: &Array1<f64>, sample_index: usize, ) -> Array1<f64>

Draw the sample_index-th (possibly noisy) gradient sample at params.

The default implementation is deterministic and equal to TaskProbe::gradient_at (i.e. a noise-free oracle). Stochastic tasks override this so that distinct sample_index values yield distinct — but reproducible — gradient samples, which lets the extractor estimate the gradient noise level deterministically.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§