MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / generate_training_data

Function generate_training_data

numpy_ml/plots/hmm_plots.py:16–29  ·  view source on GitHub ↗
(params, n_steps=500, n_examples=15)

Source from the content-addressed store, hash-verified

14
15
16def generate_training_data(params, n_steps=500, n_examples=15):
17 hmm = MultinomialHMM(A=params["A"], B=params["B"], pi=params["pi"])
18
19 # generate a new sequence
20 observations = []
21 for i in range(n_examples):
22 latent, obs = hmm.generate(
23 n_steps, params["latent_states"], params["obs_types"]
24 )
25 assert len(latent) == len(obs) == n_steps
26 observations.append(obs)
27
28 observations = np.array(observations)
29 return observations
30
31
32def default_hmm():

Callers 1

test_HMMFunction · 0.85

Calls 2

generateMethod · 0.95
MultinomialHMMClass · 0.90

Tested by 1

test_HMMFunction · 0.68