Metadata-Version: 1.0
Name: choices
Version: 0.1
Summary: Making choices from a probability distribution
Home-page: UNKNOWN
Author: Tim McNamara
Author-email: paperless@timmcnamara.co.nz
License: UNKNOWN
Description: 
        The PDist is designed to make it easy to make it easy to make 
        things happen in a probablistic manner. Provide keys with an 
        associated probability attached, and the
        
            >>> mood = PDist({'happy': 0.3, 'neutral': 0.6, 'sad': 0.1})
            >>> mood()
            'happy'
            >>> mood()
            'neutral'
        
        You can retrieve the distribution of how those values are applied
        by accessing the distribution attribute:
        
            >>> mood.distribution
            [('happy', 0.3), ('neutral', 0.6), ('sad', 0.1)]
        
        As well as a dict assigning a probability to each key, you can
        send in a list of lists/tuples. This allows for for non-hashable
        types to be used. This means that you provide objects such as 
        functions to be used as keys:
        
          >>> def grumpy(news):
          ...    return ':/'
          >>> def happy(news):
          ...    return ':)'
          >>> react = PDist([(grumpy, 0.7), (happy, 0.3)])
          >>> reaction = react()
          >>> reaction("We're getting married!")
          ':/'
        
        You are not restricted to adding p to 1. If you only have samples,
        and wish to calculate a probablilty distribution, you can provide 
        those too:
        
           >>> spotted = {'geese': 0, 'ducks': 12, 'sparrows': 4, 'other': 39}
           >>> bird_pdist = PDist(spotted)
           >>> bird_pdist.distribution
           [('geese', 0.0), ('sparrows', 0.07272727272727272), ('ducks', 0.21818181818181817), ('other', 0.7090909090909091)]
        
        Retrieving the probability of a particular key is supported. However,
        the search strategy is very inefficient and probably shouldn't be used
        outside of the interactive Python shell.
        
            >>> bird_pdist['geese']
            0.0
        
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
