MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_signals

Function get_signals

hmm_class/generate_c.py:57–70  ·  view source on GitHub ↗
(N=20, T=100, init=big_init)

Source from the content-addressed store, hash-verified

55 return M, K, D, pi, A, R, mu, sigma
56
57def get_signals(N=20, T=100, init=big_init):
58 M, K, D, pi, A, R, mu, sigma = init()
59 X = []
60 for n in range(N):
61 x = np.zeros((T, D))
62 s = 0 # initial state is 0 since pi[0] = 1
63 r = np.random.choice(K, p=R[s]) # choose mixture
64 x[0] = np.random.multivariate_normal(mu[s][r], sigma[s][r])
65 for t in range(1, T):
66 s = np.random.choice(M, p=A[s]) # choose state
67 r = np.random.choice(K, p=R[s]) # choose mixture
68 x[t] = np.random.multivariate_normal(mu[s][r], sigma[s][r])
69 X.append(x)
70 return X
71
72if __name__ == '__main__':
73 T = 500

Callers 8

fake_signalFunction · 0.90
fake_signalFunction · 0.90
fake_signalFunction · 0.90
fake_signalFunction · 0.90
fake_signalFunction · 0.90
fake_signalFunction · 0.90
fake_signalFunction · 0.90
generate_c.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected