Exemplo n.º 1
0
def run_HMM(time_series, **kwargs):
    # Directly use knowledge of the number of modes
    K = kwargs['num_gt_labels']
    D_obs = kwargs['data_dim']

    obs_hypparams = {
        'mu_0': np.zeros(D_obs),
        'sigma_0': np.eye(D_obs),
        'kappa_0': 0.10,
        'nu_0': D_obs + 2
    }

    obs_distns = [
        pyhsmm.distributions.Gaussian(**obs_hypparams) for _ in range(K)
    ]

    hmm = HMM(alpha=kwargs['alpha'],
              init_state_concentration=kwargs['init_state_concentration'],
              obs_distns=obs_distns)

    return inference(time_series, hmm, **kwargs)
Exemplo n.º 2
0
                                 alpha=6.,
                                 gamma=6.,
                                 obs_distns=GMMs,
                                 dur_distns=true_dur_distns)

data, truelabels = truemodel.generate(1000)

#################
#  remove data  #
#################

# using an HMM of course

deletion_hmm = HMM(
    init_state_concentration=10.,
    alpha=6.,
    gamma=6.,
    obs_distns=GMMs[:2],  # placeholders, not really used
)

_, todelete = deletion_hmm.generate(data.shape[0])

data[todelete == 0] == np.nan

#####################################
#  set up FrozenMixture components  #
#####################################

# list of all Gaussians
component_library = [c for m in GMMs for c in m.components]
library_size = len(component_library)