Esempio n. 1
0
 def setUp(self):
     config.StringParameter('test.param0', 'a param', default='foo')
     config.StringParameter('test.param1', 'a param', config.oneof('foo', 'bar'))
     config.IntParameter('test.param2', 'a param', default=20)
     config.IntParameter('test.param3', 'a param', config.atmost(100))
     config.IntParameter('test.param4', 'a param', config.atleast(100))
     config.IntParameter('test.param5', 'a param', config.between(10,100))
     config.IntParameter('test.param6', 'a param', lambda x: x == 50)
     config.FloatParameter('test.param7', 'a param', config.between(1.3, 2.7))
Esempio n. 2
0
#
# Parameters
#
_pmissingdatahandler = config.StringParameter(
    'evaluator.missingdata_evaluator',
    """
    Evaluator to use for handling missing data. Choices include:
        * gibbs: Gibb's sampling
        * maxentropy_gibbs: Gibbs's sampling over all completions of the
          missing values that result in maximum entropy discretization for the
          variables.  
        * exact: exact enumeration of all possible missing values (only
                 useable when there are few missing values)
    """,
    config.oneof('gibbs', 'exact', 'maxentropy_gibbs'),
    default='gibbs'
)

_missingdata_evaluators = {
    'gibbs': MissingDataNetworkEvaluator,
    'exact': MissingDataExactNetworkEvaluator,
    'maxentropy_gibbs': MissingDataMaximumEntropyNetworkEvaluator
}

def fromconfig(data_=None, network_=None, prior_=None):
    """Create an evaluator based on configuration parameters.
    
    This function will return the correct evaluator based on the relevant
    configuration parameters.