NearContextAlgebra 0.1.0.0 → 0.1.0.1
raw patch · 6 files changed
+259/−259 lines, 6 filesdep ~ContextAlgebra
Dependency ranges changed: ContextAlgebra
Files
- NearContextAlgebra.cabal +5/−5
- src/Main.hs +28/−25
- src/NearConcept.hs +213/−0
- src/NearContext.hs +11/−11
- src/NearExemplar.hs +2/−2
- src/NearModel.hs +0/−216
NearContextAlgebra.cabal view
@@ -10,13 +10,13 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.0+version: 0.1.0.1 -- A short (one-line) description of the package. synopsis: Context Algebra of near -- A longer description of the package.-description: Model of the concept near influenced by several contexts+description: Model of the concept "near" influenced by several contexts -- The license under which the package is license: BSD3@@ -26,7 +26,7 @@ -- license: -- The package author(s).-author: juergenhah+author: Jürgen Hahn -- An email address to which users can send suggestions, bug reports, and -- patches.@@ -53,14 +53,14 @@ -- Modules included in this executable, other than Main. other-modules: NearContext, - NearModel, + NearConcept, NearExemplar -- LANGUAGE extensions used by modules in this package. other-extensions: FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances, DeriveGeneric, InstanceSigs -- Other library packages from which modules are imported.- build-depends: ContextAlgebra >=0.1 && <0.2+ build-depends: ContextAlgebra >=0.2 , QuickCheck >= 2.6 , base >=4.7 && <4.8 , containers >=0.5 && <0.6
src/Main.hs view
@@ -1,20 +1,21 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-| Module : Main Description : Main module for the model of the exemplars (NearExemplar module) of the concept near influenced by several contexts (NearContext module). Including algebraic test Maintainer : hahn@geoinfo.tuwien.ac.at-Stability : beta+nStability : beta Use case of the context algebra for the concept near and the contexts: walking, driving, uphill -} module Main where+import ConceptModel import ContextLattice-import Model +import NearConcept import NearContext import NearExemplar-import NearModel -- needed for the function meet import Algebra.Lattice@@ -22,6 +23,8 @@ import qualified Data.List as L import Test.QuickCheck ++ -- | print a use case of the model main = do putStrLn "Model of the concept near influenced by contexts"@@ -43,26 +46,26 @@ putStrLn "the problem for the IR is which distance is meant by near" putStrLn "our model is able to interpret the concept 'near' influenced by several context" putStrLn "in this situation no context is given, the model can calculate probability values for given distances (exemplars)"- print $ probAllExemplars4Context ctxOne M50 allExperiences+ print $ typicalityForExemplarsInContext ctxOne M50 near putStrLn "\nthe most probable distance is now: the distance with the highest probability"- print . getMostProbableExemplar . probAllExemplars4Context ctxOne M50 $ allExperiences+ print . typicalExemplarInContext ctxOne M50 $ near putStrLn "+++++++++++++++ adding a CONTEXT +++++++++++++++" putStrLn "\nfrom a sensor we get context information that the user is walking, therefore the model is able to refine the concept near and influence it with the context near"- print $ probAllExemplars4Context (ctxOne `meet` ctxWalking) M50 allExperiences+ print $ typicalityForExemplarsInContext (ctxOne `meet` ctxWalking) M50 near putStrLn "the most probable distance is now: the distance with the highest probability"- print . getMostProbableExemplar . probAllExemplars4Context (ctxOne `meet` ctxWalking) M50 $ allExperiences+ print . typicalExemplarInContext (ctxOne `meet` ctxWalking) M50 $ near putStrLn "+++++++++++++++ adding a CONTEXT +++++++++++++++" putStrLn "\nfrom LIDAR data we know that the user is walking uphill, what can also refine the concept"- print $ probAllExemplars4Context (ctxOne `meet` ctxWalking `meet` ctxUphill) M50 allExperiences+ print $ typicalityForExemplarsInContext (ctxOne `meet` ctxWalking `meet` ctxUphill) M50 near putStrLn "\n the most probable exemplar influenced by the contexts: walking and uphill"- print . getMostProbableExemplar . probAllExemplars4Context (ctxOne `meet` ctxWalking `meet` ctxUphill) M50 $ allExperiences+ print .typicalExemplarInContext (ctxOne `meet` ctxWalking `meet` ctxUphill) M50 $ near putStrLn "+++++++++++++++ SUMMARY +++++++++++++++" putStrLn "\n To summarize, the typicality has changes without context:"- print . getMostProbableExemplar . probAllExemplars4Context ctxOne M50 $ allExperiences+ print . typicalExemplarInContext ctxOne M50 $ near putStrLn "\n influenced by the context walking to:"- print . getMostProbableExemplar . probAllExemplars4Context (ctxOne `meet` ctxWalking) M50 $ allExperiences+ print . typicalExemplarInContext (ctxOne `meet` ctxWalking) M50 $ near putStrLn "\n further refined and influenced by the context walking uphill, the most typical exemplar is:"- print . getMostProbableExemplar . probAllExemplars4Context (ctxOne `meet` ctxWalking `meet` ctxUphill) M50 $ allExperiences+ print . typicalExemplarInContext (ctxOne `meet` ctxWalking `meet` ctxUphill) M50 $ near -- * test algebraic properties -- | Idempotency test, prints the input values and the result@@ -70,14 +73,14 @@ -- @ -- Context c `meet` Context c == Context c -- @-testIdemPropertyPrinted = verboseCheck (propIdempotent :: Context Transportation -> Bool)+testIdemPropertyPrinted = verboseCheck (propIdempotent :: Context NearContext -> Bool) -- | Idempotency test, prints the result -- -- @ -- Context c `meet` Context c == Context c -- @-testIdemProperty = quickCheck (propIdempotent :: Context Transportation -> Bool)+testIdemProperty = quickCheck (propIdempotent :: Context NearContext -> Bool) -- | Commutative test,prints the input values and the result@@ -85,14 +88,14 @@ -- @ -- Context x meet Context y == Context y meet Context x -- @-testCommPropertyPrinted = verboseCheck (propCommutative :: Context Transportation -> Context Transportation -> Bool)+testCommPropertyPrinted = verboseCheck (propCommutative :: Context NearContext -> Context NearContext -> Bool) -- | Commutative test, prints the result -- -- @ -- Context x meet Context y == Context y meet Context x -- @-testCommProperty = quickCheck (propCommutative :: Context Transportation -> Context Transportation -> Bool)+testCommProperty = quickCheck (propCommutative :: Context NearContext -> Context NearContext -> Bool) -- | Associative test, prints the input values and the result@@ -100,14 +103,14 @@ -- @ -- Context x `meet` (Context y `meet` Context z) == (Context x `meet` Context y) `meet` Context z -- @-testAssocPropertyPrinted = verboseCheck (propAssociative ::Context Transportation -> Context Transportation -> Context Transportation-> Bool)+testAssocPropertyPrinted = verboseCheck (propAssociative ::Context NearContext -> Context NearContext -> Context NearContext-> Bool) -- | Associative test, prints the result -- -- @ -- Context x `meet` (Context y `meet` Context z) == (Context x `meet` Context y) `meet` Context z -- @-testAssocProperty = quickCheck (propAssociative ::Context Transportation -> Context Transportation -> Context Transportation-> Bool)+testAssocProperty = quickCheck (propAssociative ::Context NearContext -> Context NearContext -> Context NearContext-> Bool) -- * functionality of the model@@ -136,7 +139,7 @@ -- +--| -- | -- +--(1*)Exp (Ctx [Walking,Uphill]) 300 m-experiencesWalking = lambda ctxWalking allExperiences+nearWalking = filterConceptWithContext ctxWalking near -- | get all experiences for the context driving@@ -171,7 +174,7 @@ -- +--(7*)Exp (Ctx [Driving,Uphill]) 1000 m -- | -- +--(5*)Exp (Ctx [Driving,Uphill]) 10000 m-experiencesDriving = lambda ctxDriving allExperiences+nearDriving = filterConceptWithContext ctxDriving near -- | prints the experiences form the resulting context of driving uphill and driving@@ -190,11 +193,11 @@ -- +--(7*)Exp (Ctx [Driving,Uphill]) 1000 m -- | -- +--(5*)Exp (Ctx [Driving,Uphill]) 10000 m-experiencesDrivingUphill = lambda (ctxDrivingUphill `meet` ctxDriving) allExperiences+nearDrivingUphill = filterConceptWithContext (ctxDrivingUphill `meet` ctxDriving) near -- | sum the experiences for the context one-sumExp4Contexts ::((BoundedMeetSemiLattice TransportationContext))=> [([Transportation],Int)]+sumExp4Contexts ::((BoundedMeetSemiLattice NearContextLattice))=> [([NearContext],Int)] sumExp4Contexts= zipWith (\sum ctx -> (ctx,sum)) s c- where s = map ((amountExperiences . flip lambda allExperiences). Ctx) c+ where s = map ((amountExperiences . flip filterConceptWithContext near). Ctx) c c = extractContext ctxOne
+ src/NearConcept.hs view
@@ -0,0 +1,213 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-|+Module : NearConcept+Description : declaring all functions+License : GPL-3+Maintainer : hahn@geoinfo.tuwien.ac.at+Stability : Declares++define most functions and frequency values+-}+module NearConcept (near, ctxOne, ctxWalking, ctxDriving, ctxUphill+ , ctxWalkingDriving, ctxWalkingUphill, ctxDrivingUphill+ , ctxWalkingDrivingUphill, ctxZero) where++import ConceptModel+import ContextLattice+import NearContext+import NearExemplar++import Algebra.Lattice+import qualified Data.MultiSet as Mset+import Test.QuickCheck++-- | instance declaration for the near context+instance ConceptContextModel NearContext NearExemplar++-- * frequencies for contexts and exemplars+-- | list of observation frequencies for a particular context, the order equals the order of the exemplars+--+-- >>> zipWith (\exe frq-> (exe,frq)) exemplars frqWalking+-- [(50 m,0),(100 m,2),(150 m,4),(300 m,6),(450 m,6),(1000 m,4),(5000 m,1),(10000 m,0)]+frqWalking= [0,2,4,6,6,4,1,0]+frqUphill= [0,2,3,0,0,1,1,0]+frqDriving= [0,1,3,1,1,2,2,2]+frqWalkingUphill= [4,3,2,1,0,0,0,0]+frqDrivingUphill= [0,2,1,5,6,7,8,5]+frqWalkingDriving= [0,0,0,0,0,0,0,0]+frqWalkingDrivingUphill= [0,0,0,0,0,0,0,0]++-- * wrap the basic types into the context type+-- | context type for walking+--+-- >>> ctxWalking+-- Ctx [Walking]+ctxWalking = Ctx [Walking]+ctxDriving = Ctx [Driving]+ctxUphill = Ctx [Uphill]++-- | example of an combined context of walking and uphill+--+-- >>> ctxWalkingUphill+-- Ctx [Walking, Uphill]+ctxWalkingUphill = Ctx [Walking, Uphill]+ctxDrivingUphill = Ctx [Driving, Uphill]+ctxWalkingDriving = Ctx [Walking, Driving]+ctxWalkingDrivingUphill = Ctx [Walking,Driving,Uphill]++-- | top element of the lattice, equals the One context+--+-- >>> ctxOne+-- One [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]]+ctxOne = top :: NearContextLattice++-- | bottom element of the lattice, equals the Zero context+--+-- >>> ctxZero+-- Zero+ctxZero = Zero :: NearContextLattice+++-- | produce a generator for the input contexts, this values are used by quickCheck+instance Arbitrary (Context NearContext) where+ -- | represents a list of all possible contexts+ arbitrary = elements [ ctxOne, ctxWalking, ctxDriving, ctxUphill+ , ctxWalkingDriving, ctxWalkingUphill, ctxDrivingUphill+ , ctxWalkingDrivingUphill, ctxZero]+++-- * initialization of experiences+-- | creates a multiset including all exemplars and frequency values for the context walking+--+-- >>> printExperiences walkingExperiences+-- (6*)Exp (Ctx [Walking]) 450 m+-- |+-- +--(4*)Exp (Ctx [Walking]) 150 m+-- | |+-- | +--(2*)Exp (Ctx [Walking]) 100 m+-- | |+-- | +--(6*)Exp (Ctx [Walking]) 300 m+-- |+-- +--(1*)Exp (Ctx [Walking]) 5000 m+-- |+-- +--(4*)Exp (Ctx [Walking]) 1000 m+-- |+-- +--|+expWalking = createConceptForContext ctxWalking exemplars frqWalking++-- | creates the multiset for the context uphill+--+-- >>> printExperiences expUphill+-- (3*)Exp (Ctx [Uphill]) 150 m+-- |+-- +--(2*)Exp (Ctx [Uphill]) 100 m+-- |+-- +--(1*)Exp (Ctx [Uphill]) 5000 m+-- |+-- +--(1*)Exp (Ctx [Uphill]) 1000 m+-- |+-- +--|+expUphill = createConceptForContext ctxUphill exemplars frqUphill++-- | creates the multiset for the context driving+--+-- >>> printExperiences expDriving+-- (1*)Exp (Ctx [Driving]) 450 m+-- |+-- +--(3*)Exp (Ctx [Driving]) 150 m+-- | |+-- | +--(1*)Exp (Ctx [Driving]) 100 m+-- | |+-- | +--(1*)Exp (Ctx [Driving]) 300 m+-- |+-- +--(2*)Exp (Ctx [Driving]) 5000 m+-- |+-- +--(2*)Exp (Ctx [Driving]) 1000 m+-- |+-- +--(2*)Exp (Ctx [Driving]) 10000 m+expDriving = createConceptForContext ctxDriving exemplars frqDriving++expWalkingUphill = createConceptForContext ctxWalkingUphill exemplars frqWalkingUphill+expDrivingUphill = createConceptForContext ctxDrivingUphill exemplars frqDrivingUphill+expWalkingDriving = createConceptForContext ctxWalkingDriving exemplars frqWalkingDriving+expWalkingDrivingUphill= createConceptForContext ctxWalkingDrivingUphill exemplars frqWalkingDrivingUphill+++-- | resulting multiset including all experiences for all contexts+--+-- >>> printExperiences allExperiences+-- (1*)Exp (Ctx [Driving]) 450 m+-- |+-- +--(6*)Exp (Ctx [Walking]) 450 m+-- | |+-- | +--(4*)Exp (Ctx [Walking]) 150 m+-- | | |+-- | | +--(2*)Exp (Ctx [Walking]) 100 m+-- | | |+-- | | +--(6*)Exp (Ctx [Walking]) 300 m+-- | |+-- | +--(1*)Exp (Ctx [Walking,Uphill]) 300 m+-- | |+-- | +--(1*)Exp (Ctx [Walking]) 5000 m+-- | | |+-- | | +--(4*)Exp (Ctx [Walking]) 1000 m+-- | | |+-- | | +--(3*)Exp (Ctx [Walking,Uphill]) 100 m+-- | | |+-- | | +--(4*)Exp (Ctx [Walking,Uphill]) 50 m+-- | | |+-- | | +--(2*)Exp (Ctx [Walking,Uphill]) 150 m+-- | |+-- | +--(3*)Exp (Ctx [Driving]) 150 m+-- | |+-- | +--(1*)Exp (Ctx [Driving]) 100 m+-- | |+-- | +--(1*)Exp (Ctx [Driving]) 300 m+-- |+-- +--(6*)Exp (Ctx [Driving,Uphill]) 450 m+-- |+-- +--(2*)Exp (Ctx [Driving,Uphill]) 100 m+-- | |+-- | +--(2*)Exp (Ctx [Driving]) 5000 m+-- | | |+-- | | +--(2*)Exp (Ctx [Driving]) 1000 m+-- | | |+-- | | +--(2*)Exp (Ctx [Driving]) 10000 m+-- | |+-- | +--(1*)Exp (Ctx [Driving,Uphill]) 150 m+-- | |+-- | +--|+-- | |+-- | +--(5*)Exp (Ctx [Driving,Uphill]) 300 m+-- |+-- +--(3*)Exp (Ctx [Uphill]) 150 m+-- |+-- +--(8*)Exp (Ctx [Driving,Uphill]) 5000 m+-- | |+-- | +--(7*)Exp (Ctx [Driving,Uphill]) 1000 m+-- | |+-- | +--(5*)Exp (Ctx [Driving,Uphill]) 10000 m+-- | |+-- | +--|+-- | |+-- | +--(2*)Exp (Ctx [Uphill]) 100 m+-- |+-- +--(1*)Exp (Ctx [Uphill]) 5000 m+-- |+-- +--(1*)Exp (Ctx [Uphill]) 1000 m+-- |+-- +--+near = unionsConceptsForDiffContexts [expWalking+ ,expUphill+ ,expDriving+ ,expWalkingUphill+ ,expDrivingUphill+ ,expWalkingDriving+ ,expWalkingDrivingUphill]++++
src/NearContext.hs view
@@ -10,7 +10,7 @@ Models the contexts of the concept near -}-module NearContext (Transportation(..),TransportationContext(..), universe, top, arbitrary) where+module NearContext (NearContext(..),NearContextLattice(..), universe, top, arbitrary) where import ContextLattice @@ -22,7 +22,7 @@ -- * the context type used to model the concept near -- | this data type represents all contexts that are used in the near model, make sure to derive all the type classes-data Transportation =+data NearContext = -- | constructor represents the context walking Walking -- | constructor represents the context driving@@ -32,10 +32,10 @@ deriving (Show,Eq,Ord,Enum,Bounded) -- | type synonym-type TransportationContext = Context Transportation+type NearContextLattice = Context NearContext -- | to provide the model with the function universe we make an instance of Enumerable from the Algebra.Enumerable module-instance Enumerable Transportation where+instance Enumerable NearContext where -- | returns all contexts, needs the type classes Bounded and Enum to work -- -- >>> universe ::[Transportation]@@ -43,22 +43,22 @@ universe = universeBounded -- | also the wrapped type has to be an instance of Enumerable-instance Enumerable TransportationContext where+instance Enumerable NearContextLattice where - -- | returns all TransportationContexts+ -- | returns all NearContexts --- -- >>> universe ::[TransportationContext]+ -- >>> universe ::[NearContextLattice] -- [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]]- universe = tail. L.map Ctx . L.subsequences $ (universe::[Transportation])+ universe = tail. L.map Ctx . L.subsequences $ (universe::[NearContext]) -- | the context type forms a lattice with a upper bound that can be retrieved by the function top-instance BoundedMeetSemiLattice TransportationContext where+instance BoundedMeetSemiLattice NearContextLattice where -- | returns the contexts active in the upper contexts, what means no context is active, synonym for one in my thesis --- -- >>> top ::TransportationContext+ -- >>> top ::NearContextLattice -- One [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]]- top = One (universe::[Context Transportation])+ top = One (universe::[Context NearContext])
src/NearExemplar.hs view
@@ -13,7 +13,7 @@ -- be sure to have for all of these frequency values. -- The data type must derive following type classes: -- (Show, Eq, Ord, Enum,Bounded)-data Exemplar =+data NearExemplar = -- | represents the fifty metres exemplar M50 -- | represents the 100 metres exemplar@@ -39,7 +39,7 @@ exemplars = enumFromTo minBound $ maxBound `asTypeOf` M50 -- | pretty print for the Exemplar type-instance Show Exemplar where+instance Show NearExemplar where show M50 = "50 m" show M100 = "100 m" show M150 = "150 m"
− src/NearModel.hs
@@ -1,216 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE TypeSynonymInstances #-}-{-|-Module : NearModel-Description : declaring all functions-License : GPL-3-Maintainer : hahn@geoinfo.tuwien.ac.at-Stability : Declares--define most functions and frequency values--}-module NearModel (allExperiences, ctxOne, ctxWalking, ctxDriving, ctxUphill- , ctxWalkingDriving, ctxWalkingUphill, ctxDrivingUphill- , ctxWalkingDrivingUphill, ctxZero) where--import ContextLattice-import Model-import NearContext-import NearExemplar--import Algebra.Lattice-import qualified Data.MultiSet as Mset-import Test.QuickCheck---- | instance declaration for the transportation context--- , needed to have the functions: lambda, mu and the meet present-instance InterpretationModel TransportationContext Exemplar------ * frequencies for contexts and exemplars--- | list of observation frequencies for a particular context, the order equals the order of the exemplars------ >>> zipWith (\exe frq-> (exe,frq)) exemplars frqWalking--- [(50 m,0),(100 m,2),(150 m,4),(300 m,6),(450 m,6),(1000 m,4),(5000 m,1),(10000 m,0)]-frqWalking= [0,2,4,6,6,4,1,0]-frqUphill= [0,2,3,0,0,1,1,0]-frqDriving= [0,1,3,1,1,2,2,2]-frqWalkingUphill= [4,3,2,1,0,0,0,0]-frqDrivingUphill= [0,2,1,5,6,7,8,5]-frqWalkingDriving= [0,0,0,0,0,0,0,0]-frqWalkingDrivingUphill= [0,0,0,0,0,0,0,0]---- * wrap the basic types into the context type--- | context type for walking------ >>> ctxWalking--- Ctx [Walking]-ctxWalking = Ctx [Walking]-ctxDriving = Ctx [Driving]-ctxUphill = Ctx [Uphill]---- | example of an combined context of walking and uphill------ >>> ctxWalkingUphill--- Ctx [Walking, Uphill]-ctxWalkingUphill = Ctx [Walking, Uphill]-ctxDrivingUphill = Ctx [Driving, Uphill]-ctxWalkingDriving = Ctx [Walking, Driving]-ctxWalkingDrivingUphill = Ctx [Walking,Driving,Uphill]---- | top element of the lattice, equals the One context------ >>> ctxOne--- One [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]]-ctxOne = top :: Context Transportation---- | bottom element of the lattice, equals the Zero context------ >>> ctxZero--- Zero-ctxZero = Zero :: Context Transportation----- | produce a generator for the input contexts, this values are used by quickCheck-instance Arbitrary (Context Transportation) where- -- | represents a list of all possible contexts- arbitrary = elements [ ctxOne, ctxWalking, ctxDriving, ctxUphill- , ctxWalkingDriving, ctxWalkingUphill, ctxDrivingUphill- , ctxWalkingDrivingUphill, ctxZero]----- * initialization of experiences--- | creates a multiset including all exemplars and frequency values for the context walking------ >>> printExperiences walkingExperiences--- (6*)Exp (Ctx [Walking]) 450 m--- |--- +--(4*)Exp (Ctx [Walking]) 150 m--- | |--- | +--(2*)Exp (Ctx [Walking]) 100 m--- | |--- | +--(6*)Exp (Ctx [Walking]) 300 m--- |--- +--(1*)Exp (Ctx [Walking]) 5000 m--- |--- +--(4*)Exp (Ctx [Walking]) 1000 m--- |--- +--|-expWalking = createExperiencesForContext ctxWalking exemplars frqWalking---- | creates the multiset for the context uphill------ >>> printExperiences expUphill--- (3*)Exp (Ctx [Uphill]) 150 m--- |--- +--(2*)Exp (Ctx [Uphill]) 100 m--- |--- +--(1*)Exp (Ctx [Uphill]) 5000 m--- |--- +--(1*)Exp (Ctx [Uphill]) 1000 m--- |--- +--|-expUphill = createExperiencesForContext ctxUphill exemplars frqUphill---- | creates the multiset for the context driving------ >>> printExperiences expDriving--- (1*)Exp (Ctx [Driving]) 450 m--- |--- +--(3*)Exp (Ctx [Driving]) 150 m--- | |--- | +--(1*)Exp (Ctx [Driving]) 100 m--- | |--- | +--(1*)Exp (Ctx [Driving]) 300 m--- |--- +--(2*)Exp (Ctx [Driving]) 5000 m--- |--- +--(2*)Exp (Ctx [Driving]) 1000 m--- |--- +--(2*)Exp (Ctx [Driving]) 10000 m-expDriving = createExperiencesForContext ctxDriving exemplars frqDriving--expWalkingUphill = createExperiencesForContext ctxWalkingUphill exemplars frqWalkingUphill-expDrivingUphill = createExperiencesForContext ctxDrivingUphill exemplars frqDrivingUphill-expWalkingDriving = createExperiencesForContext ctxWalkingDriving exemplars frqWalkingDriving-expWalkingDrivingUphill= createExperiencesForContext ctxWalkingDrivingUphill exemplars frqWalkingDrivingUphill----- | resulting multiset including all experiences for all contexts------ >>> printExperiences allExperiences--- (1*)Exp (Ctx [Driving]) 450 m--- |--- +--(6*)Exp (Ctx [Walking]) 450 m--- | |--- | +--(4*)Exp (Ctx [Walking]) 150 m--- | | |--- | | +--(2*)Exp (Ctx [Walking]) 100 m--- | | |--- | | +--(6*)Exp (Ctx [Walking]) 300 m--- | |--- | +--(1*)Exp (Ctx [Walking,Uphill]) 300 m--- | |--- | +--(1*)Exp (Ctx [Walking]) 5000 m--- | | |--- | | +--(4*)Exp (Ctx [Walking]) 1000 m--- | | |--- | | +--(3*)Exp (Ctx [Walking,Uphill]) 100 m--- | | |--- | | +--(4*)Exp (Ctx [Walking,Uphill]) 50 m--- | | |--- | | +--(2*)Exp (Ctx [Walking,Uphill]) 150 m--- | |--- | +--(3*)Exp (Ctx [Driving]) 150 m--- | |--- | +--(1*)Exp (Ctx [Driving]) 100 m--- | |--- | +--(1*)Exp (Ctx [Driving]) 300 m--- |--- +--(6*)Exp (Ctx [Driving,Uphill]) 450 m--- |--- +--(2*)Exp (Ctx [Driving,Uphill]) 100 m--- | |--- | +--(2*)Exp (Ctx [Driving]) 5000 m--- | | |--- | | +--(2*)Exp (Ctx [Driving]) 1000 m--- | | |--- | | +--(2*)Exp (Ctx [Driving]) 10000 m--- | |--- | +--(1*)Exp (Ctx [Driving,Uphill]) 150 m--- | |--- | +--|--- | |--- | +--(5*)Exp (Ctx [Driving,Uphill]) 300 m--- |--- +--(3*)Exp (Ctx [Uphill]) 150 m--- |--- +--(8*)Exp (Ctx [Driving,Uphill]) 5000 m--- | |--- | +--(7*)Exp (Ctx [Driving,Uphill]) 1000 m--- | |--- | +--(5*)Exp (Ctx [Driving,Uphill]) 10000 m--- | |--- | +--|--- | |--- | +--(2*)Exp (Ctx [Uphill]) 100 m--- |--- +--(1*)Exp (Ctx [Uphill]) 5000 m--- |--- +--(1*)Exp (Ctx [Uphill]) 1000 m--- |--- +---allExperiences = Mset.unions [expWalking- ,expUphill- ,expDriving- ,expWalkingUphill- ,expDrivingUphill- ,expWalkingDriving- ,expWalkingDrivingUphill]----