Exemple #1
0
    def anal_kR2(self, dataset, key='valid', steps=10):
        """
    Compute the k-steps ahead R2 between the data produced by the Generative
    Model and the Observations
    """
        zpath = self.eval(dataset, 'Recognition:loc', key=key)
        dataset[key + '_StateSeq'] = zpath
        zpath = self.eval(dataset, 'Posterior:loc', key=key)
        dataset[key + '_StateSeq'] = zpath
        zpath = self.eval(dataset, 'Posterior:loc', key=key)
        dataset[key + '_StateSeq'] = zpath
        zpath = self.eval(dataset, 'Posterior:loc', key=key)
        dataset[key + '_StateSeq'] = zpath

        kR2 = np.zeros(10)
        obs = dataset[key + '_Observation']
        preds = self.eval(dataset, 'Generative:prediction', key=key)
        R2 = compute_R2_from_sequences(obs[:, :], preds[:, :])
        kR2[0] = R2
        for k in range(1, steps):
            preds = self.eval(dataset, 'Generative:prediction', key=key)
            R2 = compute_R2_from_sequences(obs[:, k:], preds[:, k:])
            zpath = self.eval(dataset, 'LLDS:loc', key=key)
            dataset[key + '_StateSeq'] = zpath
            kR2[k] = R2

        return kR2
Exemple #2
0
 def anal_R2(self, dataset, subdset='valid', axis=None):
     """
 """
     data = dataset[subdset + '_' + 'Observation_0']
     preds = self.eval('Generative:loc', dataset,
                       key=subdset)[0]  # eval returns a list
     R2 = compute_R2_from_sequences(data, preds, axis=axis)
     return R2
Exemple #3
0
 def anal_R2(self, dataset, key='valid'):
     """
 Compute the R2 between the data produced by the Generative Model and the
 Observations
 """
     obs = dataset[key + '_Observation']
     preds = self.eval(dataset, 'Generative:loc', key='valid')
     R2 = compute_R2_from_sequences(obs, preds)
     return R2