Skip to main content

Study

Struct Study 

Source
pub struct Study {
Show 15 fields pub id: String, pub name: String, pub search_space: SearchSpace, pub strategy: SearchStrategy, pub pruning: PruningStrategy, pub objectives: Vec<Objective>, pub trials: Vec<Trial>, pub frozen: HashMap<String, Value>, pub seeds: Vec<i64>, pub composite: Option<CompositeObjective>, pub created_at: Option<DateTime<Utc>>, pub updated_at: Option<DateTime<Utc>>, pub tags: Vec<String>, pub git_sha: Option<String>, pub planned_trials: Option<usize>,
}
Expand description

An optimization study: orchestrates multiple trials.

Fields§

§id: String

Unique identifier, generated by Study::new.

§name: String

Human-readable name; needs no uniqueness.

§search_space: SearchSpace

The dimensions trials are sampled from.

§strategy: SearchStrategy

How configurations are chosen (grid, random, TPE, …).

§pruning: PruningStrategy

Early-stopping policy for unpromising trials; None by default.

§objectives: Vec<Objective>

Declared objectives. Only the first is scored today (see Study::objective_value), unless composite overrides it.

§trials: Vec<Trial>

Every trial the study has run, in start order — terminal and in-flight alike.

§frozen: HashMap<String, Value>

Study-level fixed parameters, injected into every trial’s params by the runner (same mechanism as SearchSpace::freeze, but settable after the space was built).

§seeds: Vec<i64>

Experiment seeds: when non-empty, every sampled configuration is evaluated once per seed (trial params carry "seed"), giving each seed an independent cache line and resumable trial.

§composite: Option<CompositeObjective>

Scalar objective composed from several metrics; takes precedence over objectives when set.

§created_at: Option<DateTime<Utc>>

When the study was created. serde(default): absent in pre-timestamp JSON.

§updated_at: Option<DateTime<Utc>>

When the study was last saved/modified.

§tags: Vec<String>

Free-form labels for filtering studies in listings.

§git_sha: Option<String>

Git commit the study ran at, for reproducibility bookkeeping.

§planned_trials: Option<usize>

Total trials resolved by the sampler at run start (grid sizes are unknown until the search space is prepared).

Implementations§

Source§

impl Study

Source

pub fn new( name: impl Into<String>, search_space: SearchSpace, strategy: SearchStrategy, objectives: Vec<Objective>, ) -> Self

A fresh study with a generated id and created_at stamped now: no trials, no pruning (PruningStrategy::None), no composite objective. Layer options on with the with_* builders.

Source

pub fn with_pruning(self, pruning: PruningStrategy) -> Self

Builder: replace the pruning strategy (the default from Study::new is PruningStrategy::None).

Source

pub fn with_composite(self, composite: CompositeObjective) -> Self

Builder: set the composite objective. Once set it becomes the value the optimizer sees, overriding objectives for scoring and direction — see Study::objective_value.

Source

pub fn completed_trials(&self) -> Vec<&Trial>

Trials in TrialState::Completed — the population pruners compare against. Pruned and failed trials are excluded.

Source

pub fn primary_direction(&self) -> Option<Direction>

Direction of the effective objective (composite if set, else the first declared objective).

Source

pub fn objective_value(&self, trial: &Trial) -> Option<f64>

The single source of truth for scoring a trial: the composite objective if set, else the best value of the first objective’s metric. None for incomplete trials or missing metrics.

Source

pub fn best_trial(&self) -> Option<&Trial>

Get the best trial for the effective objective.

Source

pub fn best_value(&self) -> Option<f64>

Objective value of the best trial.

Source

pub fn total_trials(&self) -> Option<usize>

Number of total planned trials (if known). Prefers the count the sampler resolved at run start (covers grid strategies).

Source

pub fn progress(&self) -> f64

Fraction of trials completed.

Trait Implementations§

Source§

impl Clone for Study

Source§

fn clone(&self) -> Study

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Study

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Study

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Study

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Study

§

impl RefUnwindSafe for Study

§

impl Send for Study

§

impl Sync for Study

§

impl Unpin for Study

§

impl UnsafeUnpin for Study

§

impl UnwindSafe for Study

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

The receiver as &dyn Any, ready for downcast_ref.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.