Struct ark_api::ml::Experiment

source ·
pub struct Experiment { /* private fields */ }
Expand description

A machine learning context. Takes batches of observations, and produces corresponding batches of actions.

Implementations§

source§

impl Experiment

source

pub fn new( host: &HiveHost, game_name: &str, experiment_name: &str, num_remote_workers: u32, config: &str, checkpoint: Option<&str>, training_duration_in_seconds: u64, protocol: &ProtocolConfig ) -> impl Future<Output = Result<Self, Error>>

Start training with a new experiment.

host where the hive server exists. game_name identifier for a type of game, e.g. ‘pong’ or ‘moreau-arena’. experiment_name identifier for this experiment. This can be any arbitrary data. If the server already has an experiment with that name then a number will be appended to make it unique. num_features number of floating point values the neural network takes as input in each observation. num_actions number of floating point values the neural network outputs for each observation. num_remote_workers number of workers that should be started in the cloud. Using a non-zero number is only supported when using a cloud host. config is a piece of data that contains all the necessary information to re-create the training run. This is not used anywhere internally, but when connecting to an existing experiment you can query it using the Experiment::config method. The only constraint on this data is that it must be valid json. This is very useful for remote workers as they can download this configuration. checkpoint optional reference to checkpoint data to load from. TODO: Api for listing checkpoints. training_duration_in_seconds Number of seconds that the training will run for. The hive server will stop the experiment after this amount of time. This is primarily useful when training in the cloud with remote workers,

source

pub async fn new_from_settings( host: HiveHost, settings: StartExperimentSettings ) -> Result<Self, Error>

Start training with a new experiment.

host where the hive server exists. settings all data required to spawn the experiment

source

pub fn connect_to_experiment( host: &HiveHost, run_id: &str ) -> impl Future<Output = Result<Self, Error>>

Connects to an already running experiment

source

pub fn config(&self) -> impl Future<Output = Result<ExperimentConfig, Error>>

Retrieves the configuration for the experiment

This may require a download from the hive server.

source

pub fn raw_config(&self) -> impl Future<Output = Result<String, Error>>

Retrieves the configuration for the experiment

This may require a download from the hive server.

source

pub fn metrics(&self) -> impl Future<Output = Result<Vec<(String, f32)>, Error>>

Retrieves current training metrics for Hive

source

pub fn snapshot(&self) -> impl Future<Output = Result<Vec<u8>, Error>>

Retrieves a trained snapshot.

source

pub fn push_training_experiences( &self, observations: &[Observation<'_>] ) -> Result<Vec<Response>, Error>

Trains using the current batch of observations.

source

pub fn push_demonstration_experiences( &self, demonstrations: &[Demonstration<'_>] ) -> Result<(), Error>

Send demonstration experiences recorded in ark to Hive. Will return an error if the Hive protocol doesn’t support imitation learning

source

pub fn push_augmented_experiences( &self, observations: &[AugmentedObservation<'_>] ) -> Result<(), Error>

Send augmented experiences augmented in ark to Hive.

The list of observations represents one timestep for a set of agents. You should not include multiple observations for a single agent, call this method multiple times instead.

source

pub fn stop_experiment(self) -> Result<(), Error>

Stops an experiment and all associated workers.

If you just want to disconnect this client (without stopping potential remote workers) then simply drop the experiment.

Trait Implementations§

source§

impl Drop for Experiment

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.