| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Haal.Experiment
Description
This module exports the basic types, classes and functions that are required to easily construct and configure learning experiments.
Synopsis
- type Experiment sul result = ExperimentT sul Identity result
- type ExperimentT sul (m :: Type -> Type) result = ReaderT sul m result
- class Learner (l :: Type -> Type -> Type) (aut :: Type -> Type -> Type -> Type) s | l -> aut s where
- initialize :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => l i o -> ExperimentT (sul i o) m (l i o)
- refine :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => l i o -> [i] -> ExperimentT (sul i o) m (l i o)
- learn :: forall sul (m :: Type -> Type) i o. (SUL sul m, Automaton aut s, FiniteOrd i, FiniteOrd s, FiniteOrd o) => l i o -> ExperimentT (sul i o) m (l i o, aut s i o)
- class EquivalenceOracle or where
- data Statistics (aut :: Type -> Type -> Type -> Type) s i o = Statistics {
- statsRounds :: Int
- statsCexs :: [[i]]
- statsHyps :: [aut s i o]
- experiment :: forall sul (m :: Type -> Type) aut s learner oracle i o. (SUL sul m, Automaton aut s, Learner learner aut s, EquivalenceOracle oracle, FiniteOrd i, FiniteOrd s, FiniteOrd o) => learner i o -> oracle -> ExperimentT (sul i o) m (aut s i o, Statistics aut s i o)
- runExperiment :: Reader r a -> r -> a
- pairwiseWalk :: (SUL sul m, Automaton aut s, Ord i, Eq o) => sul i o -> aut s i o -> [i] -> m Bool
- execute :: (SUL sul m, Automaton aut s, Ord i, Eq o) => sul i o -> aut s i o -> [[i]] -> m ([i], [o])
- findCex :: forall sul (m :: Type -> Type) aut s or i o. (SUL sul m, Automaton aut s, EquivalenceOracle or, FiniteOrd i, FiniteOrd s, Eq o) => or -> aut s i o -> ExperimentT (sul i o) m (or, ([i], [o]))
- runExperimentT :: ReaderT r m a -> r -> m a
Documentation
type Experiment sul result = ExperimentT sul Identity result Source #
The Experiment type is a type alias for the ExperimentT type
with the Identity monad. This allows for running pure experiments.
type ExperimentT sul (m :: Type -> Type) result = ReaderT sul m result Source #
The ExperimentT type is a monad transformer that allows for
running experiments in a reader monad. This may prove useful for
learning real systems, which requires IO.
class Learner (l :: Type -> Type -> Type) (aut :: Type -> Type -> Type -> Type) s | l -> aut s where Source #
The Learner type class defines the interface for learning algorithms.
Instances of this class should provide methods to initialize the learner,
refine the learner with a counterexample, and learn an automaton. The type l
determines the type of automaton aut that is learned.
Methods
initialize :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => l i o -> ExperimentT (sul i o) m (l i o) Source #
refine :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => l i o -> [i] -> ExperimentT (sul i o) m (l i o) Source #
learn :: forall sul (m :: Type -> Type) i o. (SUL sul m, Automaton aut s, FiniteOrd i, FiniteOrd s, FiniteOrd o) => l i o -> ExperimentT (sul i o) m (l i o, aut s i o) Source #
Instances
| Learner LMstar MealyAutomaton StateID Source # | |
Defined in Haal.Learning.LMstar Methods initialize :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => LMstar i o -> ExperimentT (sul i o) m (LMstar i o) Source # refine :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => LMstar i o -> [i] -> ExperimentT (sul i o) m (LMstar i o) Source # learn :: forall sul (m :: Type -> Type) i o. (SUL sul m, Automaton MealyAutomaton StateID, FiniteOrd i, FiniteOrd StateID, FiniteOrd o) => LMstar i o -> ExperimentT (sul i o) m (LMstar i o, MealyAutomaton StateID i o) Source # | |
class EquivalenceOracle or where Source #
The EquivalenceOracle type class defines the interface for equivalence oracles.
Instances of this class should provide methods to generate a test suite
Methods
testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => or -> aut s i o -> (or, [[i]]) Source #
Instances
data Statistics (aut :: Type -> Type -> Type -> Type) s i o Source #
The Statistics data type is parameterized by the type of model being learned
and the state, input and output types of the model. Its purpose is to keep track of
different experimental stats. For the time being, only the number of rounds statsRounds,
the counterexamples statsCexs and the intermediate hypotheses statsHyps are being kept
track of.
Constructors
| Statistics | |
Fields
| |
Instances
| (Show i, Show (aut s i o)) => Show (Statistics aut s i o) Source # | |
Defined in Haal.Experiment Methods showsPrec :: Int -> Statistics aut s i o -> ShowS # show :: Statistics aut s i o -> String # showList :: [Statistics aut s i o] -> ShowS # | |
experiment :: forall sul (m :: Type -> Type) aut s learner oracle i o. (SUL sul m, Automaton aut s, Learner learner aut s, EquivalenceOracle oracle, FiniteOrd i, FiniteOrd s, FiniteOrd o) => learner i o -> oracle -> ExperimentT (sul i o) m (aut s i o, Statistics aut s i o) Source #
The experiment function returns an Experiment that can be run with
the runExperiment function. It takes a learner and an equivalence oracle
and then requires a system under learning (SUL) to run the experiment.
runExperiment :: Reader r a -> r -> a Source #
The runExperiment function runs an experiment in the Experiment monad.
It is just an alias for runReader.
pairwiseWalk :: (SUL sul m, Automaton aut s, Ord i, Eq o) => sul i o -> aut s i o -> [i] -> m Bool Source #
The pairwiseWalk function executes a test case on both the SUL and the automaton
simultaneously, checking if the outputs are the same.
execute :: (SUL sul m, Automaton aut s, Ord i, Eq o) => sul i o -> aut s i o -> [[i]] -> m ([i], [o]) Source #
The execute function executes the test suite of an oracle, given a SUL and an automaton.
findCex :: forall sul (m :: Type -> Type) aut s or i o. (SUL sul m, Automaton aut s, EquivalenceOracle or, FiniteOrd i, FiniteOrd s, Eq o) => or -> aut s i o -> ExperimentT (sul i o) m (or, ([i], [o])) Source #
The findCex function executes the test suite of each oracle to the automaton
and SUL.
runExperimentT :: ReaderT r m a -> r -> m a Source #
The runExperimentT function runs an experiment in the ExperimentT monad.
It is just an alias for runReaderT.