Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Period = Int
- type ExperimentNumber = Int
- type RepetitionNumber = Int
- type ReplicationNumber = Int
- data Phase
- class (Monad (ExpM a), MonadUnliftIO (ExpM a), NFData a, NFData (InputState a), NFData (InputValue a), Serialize (InputValue a), Serialize (InputState a), Serialize (Serializable a)) => ExperimentDef a where
- type ExpM a :: Type -> Type
- type Serializable a :: Type
- type InputValue a :: Type
- type InputState a :: Type
- generateInput :: GenIO -> a -> InputState a -> Period -> ExpM a (InputValue a, InputState a)
- runStep :: Phase -> a -> InputValue a -> Period -> ExpM a ([StepResult], a)
- parameters :: a -> [ParameterSetup a]
- equalExperiments :: (a, InputState a) -> (a, InputState a) -> Bool
- serialisable :: a -> ExpM a (Serializable a)
- deserialisable :: Serializable a -> ExpM a a
- beforeExperimentStartHook :: ExperimentNumber -> a -> ExpM a a
- beforePreparationHook :: ExperimentNumber -> RepetitionNumber -> GenIO -> a -> ExpM a a
- beforeWarmUpHook :: ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> GenIO -> a -> ExpM a a
- beforeEvaluationHook :: ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> GenIO -> a -> ExpM a a
- afterPreparationHook :: a -> ExperimentNumber -> RepetitionNumber -> IO ()
- afterWarmUpHook :: a -> ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> IO ()
- afterEvaluationHook :: a -> ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> IO ()
Documentation
type ExperimentNumber = Int Source #
type RepetitionNumber = Int Source #
type ReplicationNumber = Int Source #
Phase of experiment. Each experiment runs through all phases, where however a phase may have 0 steps.
PreparationPhase | For preparing the evaluation. For instance to let a machine learning algorithm learn its function, before it is evaluated. |
WarmUpPhase | The warm up phase is equal to the evaluation phase, but does not count as evaluation. Used to get the system in a steady state. |
EvaluationPhase | Evaluation phase. |
class (Monad (ExpM a), MonadUnliftIO (ExpM a), NFData a, NFData (InputState a), NFData (InputValue a), Serialize (InputValue a), Serialize (InputState a), Serialize (Serializable a)) => ExperimentDef a where Source #
Definition of the Experiment.
type ExpM a :: Type -> Type Source #
Monad to run experiments in. In most cases you want this to be IO
.
type Serializable a :: Type Source #
Type that is used to serialize the current state.
type InputValue a :: Type Source #
The input to the system for running a step. Set to ()
if unused.
type InputState a :: Type Source #
Can be used to save a information from one call to generateInput
to the next. Set to ()
if unused.
generateInput :: GenIO -> a -> InputState a -> Period -> ExpM a (InputValue a, InputState a) Source #
Generate some input values and possibly modify state. This function can be used to change the state. It is called
before runStep
and its output is used to call runStep
.
default generateInput :: (InputValue a ~ (), InputState a ~ ()) => GenIO -> a -> InputState a -> Period -> ExpM a (InputValue a, InputState a) Source #
runStep :: Phase -> a -> InputValue a -> Period -> ExpM a ([StepResult], a) Source #
Run a step of the environment and return new state and result.
parameters :: a -> [ParameterSetup a] Source #
Provides the parameter setting. Parameters are used to design the experiment instances, e.g. the variants that will be run.
default parameters :: a -> [ParameterSetup a] Source #
equalExperiments :: (a, InputState a) -> (a, InputState a) -> Bool Source #
This function defines how to find experiments that can be resumed. Note that the experiments name and experiment info parameters are always comparison factors, that is, experiments with different names or info parameters are unequal. The default is always True.
default equalExperiments :: (a, InputState a) -> (a, InputState a) -> Bool Source #
serialisable :: a -> ExpM a (Serializable a) Source #
Function to convert to a serializable object. Can be used to convert the state to serialisable representation.
default serialisable :: a ~ Serializable a => a -> ExpM a (Serializable a) Source #
deserialisable :: Serializable a -> ExpM a a Source #
Function to convert from a serializable object. Can be used to convert the state from its serialisable representation.
default deserialisable :: a ~ Serializable a => Serializable a -> ExpM a a Source #
beforeExperimentStartHook :: ExperimentNumber -> a -> ExpM a a Source #
Function to call before starting the experiment, but after setting the parameters. E.g. one could recereate an ANN, if the structure may have changed with a parameter.
beforePreparationHook :: ExperimentNumber -> RepetitionNumber -> GenIO -> a -> ExpM a a Source #
Function to call on the state before the preparation. This function is only executed if the preparation phase exists (that is >0 preparation steps) and is started from period 0!
default beforePreparationHook :: ExperimentNumber -> RepetitionNumber -> GenIO -> a -> ExpM a a Source #
beforeWarmUpHook :: ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> GenIO -> a -> ExpM a a Source #
Function to call on the state before the warm up phase. This function is only executed if a warm up phase exists (that is >0 warm-up steps) and is initialised, which happens on the first time it is started!
default beforeWarmUpHook :: ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> GenIO -> a -> ExpM a a Source #
beforeEvaluationHook :: ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> GenIO -> a -> ExpM a a Source #
Function to call on the state before the evaluation phase. This function is only executed if the evaluation phase exists (that is >0 evaluation steps) and is initialised which happens on the first time it is started!
default beforeEvaluationHook :: ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> GenIO -> a -> ExpM a a Source #
afterPreparationHook :: a -> ExperimentNumber -> RepetitionNumber -> IO () Source #
Function to call after the preparation phase, e.g. it can be used to move files. This function is only executed if the preparation phase is updated. The first parameter is the input state and is only used for type checking.
default afterPreparationHook :: a -> ExperimentNumber -> RepetitionNumber -> IO () Source #
afterWarmUpHook :: a -> ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> IO () Source #
Function to call after the warmUp phase, e.g. it can be used to move files. This function is only executed if the warmUp phase is updated. The first parameter is the input state and is only used for type checking.
default afterWarmUpHook :: a -> ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> IO () Source #
afterEvaluationHook :: a -> ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> IO () Source #
Function to call after the evaluation phase, e.g. it can be used to move files. This function is only executed if the evaluation phase is updated. The first parameter is the input state before the evaluation and is only used for type checking.
default afterEvaluationHook :: a -> ExperimentNumber -> RepetitionNumber -> ReplicationNumber -> IO () Source #