Package gPy :: Module Data :: Class Data2
[hide private]
[frames] | no frames]

Class Data2

source code


Attempt to implement ADTrees as a single flat dictionary

Instance Methods [hide private]
 
__init__(self, rawdata, domain=None, rmin=200)
Initialise a from rawdata
source code
 
_make_dict(self, i, variables, records, rmin, data)
Each key is of form eg (None,1,None,2) indicates a branch corresponding to variable1=1 and variable3=2 and all others summed out
source code
 
_test(self, variables) source code
 
marginal(self, variables)
Return dict mapping non-zero insts (as indices) to values
source code
 
_marginal(self, branch, vindices, dkt)
Return a dictionary mapping insts of variables to their values (where non-zero)
source code

Inherited from Variables.SubDomain: __add__, __div__, __iadd__, __idiv__, __imul__, __isub__, __mul__, __rdiv__, __repr__, __rmul__, __str__, __sub__, copy, drop_variable, drop_variables, inst2index, insts, insts_indices, marginalise_onto, sumout, table_size, uses_default_domain, variables, varvalues

Inherited from Variables.Domain: add_domain_variable, add_domain_variables, add_domain_variables_from_rawdata, change_domain_variable, change_domain_variables, common_domain, known_variable, numvals, values

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Instance Variables [hide private]

Inherited from Variables.SubDomain (private): _variables

Inherited from Variables.Domain (private): _domain, _instd, _numvals

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, rawdata, domain=None, rmin=200)
(Constructor)

source code 

Initialise a from rawdata

Parameters:
  • variables - The subset of domain variables for the object.
  • domain - A domain for the model. If None the internal default domain is used. If the string 'new', a new empty domain is used.
  • new_domain_variables - A dictionary containing a mapping from any new variables to their values. domain is updated with these values
  • must_be_new - Whether domain variables in new_domain_variables have to be new
  • check - Whether to check that all variables exist in domain
Raises:
  • VariableError - If a variable in new_domain_variables already exists with values different from its values in new_domain_variables; Or if must_be_new is set and the variable already exists. Or if check is set and a variable in variables is not in the domain
Overrides: object.__init__

_make_dict(self, i, variables, records, rmin, data)

source code 

Each key is of form eg (None,1,None,2) indicates a branch corresponding to variable1=1 and variable3=2 and all others summed out

Each value is a tuple of tuples. Each individual tuple is the instantiation of the remaining variables and finally the count

Note that each split has a None branch, corresponding to all values for the variable given by that depth

_marginal(self, branch, vindices, dkt)

source code 

Return a dictionary mapping insts of variables to their values (where non-zero)

counts are conditional on the inst branch