Beispiel #1
0
 def from_metadata(cls, metadata, rng):
     cgpm_row_divide = build_cgpm(metadata['cgpm_row_divide'], rng)
     cgpm_components_array = \
         build_cgpm(metadata['cgpm_components_array'], rng)
     model = cls(cgpm_row_divide, cgpm_components_array.cgpm_base, rng)
     model.rowid_to_component = dict(metadata['rowid_to_component'])
     model.cgpm_components_array = cgpm_components_array
     return model
Beispiel #2
0
 def from_metadata(cls, metadata, rng, multiprocess=1):
     model = cls(
         metadata['outputs'],
         metadata['inputs'],
         metadata['distributions'],
         chains=metadata['chains'],
         Cd=metadata.get('Cd', None),
         Ci=metadata.get('Ci', None),
         rng=rng,
     )
     builder = lambda blob: build_cgpm(blob, rng)
     cgpms = mapper(builder, metadata['cgpms'], multiprocess)
     model.cgpms = cgpms
     return model
Beispiel #3
0
 def from_metadata(cls, metadata, rng):
     cgpms = [build_cgpm(blob, rng) for blob in metadata['cgpms']]
     model = cls(cgpms, accuracy=metadata['accuracy'], rng=rng)
     return model
Beispiel #4
0
def clone_cgpm(cgpm_base, rng):
    """Create clone of given CGPM."""
    metadata = cgpm_base.to_metadata()
    return build_cgpm(metadata, rng)
Beispiel #5
0
 def from_metadata(cls, metadata, rng):
     cgpms = [build_cgpm(blob, rng) for blob in metadata['cgpms']]
     model = cls(cgpms, metadata['indexer'], rng)
     model.rowid_to_index = dict(metadata['rowid_to_index'])
     return model