Maintainer | hahn@geoinfo.tuwien.ac.at |
---|---|

Stability | beta |

Safe Haskell | None |

Language | Haskell2010 |

This module implements the necessary functions to model a concept and the context influence. The concept is represented by several exemplars. For each influencing context the exemplars have different observation frequency. This conncetion is modeled here by a multiset.

- data Experience c e = Exp c e
- type Experiences c e = MultiSet (Experience c e)
- type Probability = Float
- class (Ord c, Ord e, Show c, Show e) => InterpretationModel c e
- createExperiencesForContext :: (Show c, Ord c, Show e, Ord e) => c -> [e] -> [Int] -> Experiences c e
- manyfoldExperiences :: (Ord c, Show c, Ord e, Show e) => Experience c e -> Occur -> Experiences c e
- amountExperiences :: Experiences (Context c) e -> Int
- lambda :: (Enumerable c, Enumerable (Context c), Ord e, Eq c, Ord c) => Context c -> Experiences (Context c) e -> Experiences (Context c) e
- mu :: (Enumerable c, Enumerable (Context c), Ord e, Ord c) => Experience (Context c) e -> Experiences (Context c) e -> Probability
- filterExemplars :: (Ord c, Ord e) => e -> Experiences c e -> Experiences c e
- probAllExemplars4Context :: (Ord c, Ord e, Enum e, Bounded e, Enumerable c, Enumerable (Context c)) => Context c -> e -> Experiences (Context c) e -> [(e, Probability)]
- getMostProbableExemplar :: Ord e => [(e, Probability)] -> (e, Probability)
- printExperiences :: (Show e, Show c) => Experiences c e -> IO ()
- addExperience :: (Ord c, Ord e) => Experience c e -> Experiences c e -> Experiences c e

# Documentation

data Experience c e Source

Each experience is formed by a exemplar of type e and a context c this exemplar was observed at.

Exp c e | constructor; establishes an experience from a context and an exemplar |

(Eq c, Eq e) => Eq (Experience c e) | |

(Ord c, Ord e) => Ord (Experience c e) | |

(Show c, Show e) => Show (Experience c e) |

type Experiences c e = MultiSet (Experience c e) Source

All experiences are hold in a multiset

type Probability = Float Source

type synonym for better readability

class (Ord c, Ord e, Show c, Show e) => InterpretationModel c e Source

the class defines the necessary functions needed for the context algebra

createExperiencesForContext Source

:: (Show c, Ord c, Show e, Ord e) | |

=> c | context in which the experiences were made |

-> [e] | exemplars which are observed |

-> [Int] | amount of observations for one exemplar in this context |

-> Experiences c e | resulting experience type |

combines the observation amount of exemplars for one context

:: (Ord c, Show c, Ord e, Show e) | |

=> Experience c e | experience that is observed several times |

-> Occur | amount of observations of the experience |

-> Experiences c e | experiences with the given amount and type |

If an experience is made several times the amount can be specified by the `amount`

:: Experiences (Context c) e | experinces to be counted |

-> Int | amount of experiences |

calculates the amount of experiences that are present

:: (Enumerable c, Enumerable (Context c), Ord e, Eq c, Ord c) | |

=> Context c | context used to filter the experiences |

-> Experiences (Context c) e | experiences to filter |

-> Experiences (Context c) e | filtered experiences, more finer experiences are returned |

filters experiences for a context, gets experiences for a finer context, the context c has to be more finer than the context that are included in the experiences

:: (Enumerable c, Enumerable (Context c), Ord e, Ord c) | |

=> Experience (Context c) e | exemplar and context to look for |

-> Experiences (Context c) e | experiences that are considered |

-> Probability | probability of the exemplar in this context for the given experiences |

returns a probability of an exemplar observed in a context for the given experiences

:: (Ord c, Ord e) | |

=> e | exemplar used to filter the experiences |

-> Experiences c e | experiences that are filtered |

-> Experiences c e | experiences including values for the exemplar e |

returns experiences for the exemplar given in the first argument `e`

in quantum mechanics called projector

# functions to print and export

probAllExemplars4Context Source

:: (Ord c, Ord e, Enum e, Bounded e, Enumerable c, Enumerable (Context c)) | |

=> Context c | context the distribution is made for |

-> e | exemplar type, used as type parameter |

-> Experiences (Context c) e | experiences the distribution is made of |

-> [(e, Probability)] | returned distribution |

returns the observation distribution for the context c, the type e is only used as type parameter

getMostProbableExemplar Source

:: Ord e | |

=> [(e, Probability)] | list of tupels of Exemplars and the probability value |

-> (e, Probability) | tupel with the highest probability value |

returns the most probable exemplar given by the list of tuples of (Exemplar, Probability)

:: (Show e, Show c) | |

=> Experiences c e | experience to convert to IO |

-> IO () | returned IO() |

converts the experiences type to a IO()

# functions for further development of the model

:: (Ord c, Ord e) | |

=> Experience c e | new experience to add |

-> Experiences c e | given experiences where to add the new experience |

-> Experiences c e | resulting experiences including the new and the given experiences |

adds the `new`

experience to the given experiences