예제 #1
0
    def __init__(self, latent, data, kernel_config, seed=None, 
                 fixed_k = False, relation_class = None, 
                 threadpool = None):

        # FIXME add seed
        print "FIXED_K=", fixed_k
        # create the model
        self.rng = pyirm.RNG()
        if seed != None:
            pyirm.set_seed(self.rng, seed)
        
        if relation_class == None:
            relation_class = pyirmutil.Relation

        print "Running with relation_class=", relation_class
        self.model = irmio.create_model_from_data(data, rng=self.rng, 
                                                  fixed_k = fixed_k, 
                                                  relation_class=relation_class)
        irmio.set_model_latent(self.model, latent, self.rng)
        self.iters = 0
        
        self.kernel_config = kernel_config

        self.PT = False
        if len(kernel_config) == 1 and kernel_config[0][0] == "parallel_tempering":
            self.PT = True
            self.chain_states = []

            # create the chain states
            for t in kernel_config[0][1]['temps']:
                self.chain_states.append(irmio.get_latent(self.model))

        self.threadpool = threadpool
예제 #2
0
 def get_state(self, include_ss=True):
     return irmio.get_latent(self.model, include_ss)