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

Function big_init

hmm_class/generate_c.py:26–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 return M, K, D, pi, A, R, mu, sigma
25
26def big_init():
27 M = 5
28 K = 3
29 D = 2
30
31 pi = np.array([1, 0, 0, 0, 0]) # initial state distribution
32
33 A = np.array([
34 [0.9, 0.025, 0.025, 0.025, 0.025],
35 [0.025, 0.9, 0.025, 0.025, 0.025],
36 [0.025, 0.025, 0.9, 0.025, 0.025],
37 [0.025, 0.025, 0.025, 0.9, 0.025],
38 [0.025, 0.025, 0.025, 0.025, 0.9],
39 ]) # state transition matrix - likes to stay where it is
40
41 R = np.ones((M, K)) / K # mixture proportions
42
43 mu = np.array([
44 [[0, 0], [1, 1], [2, 2]],
45 [[5, 5], [6, 6], [7, 7]],
46 [[10, 10], [11, 11], [12, 12]],
47 [[15, 15], [16, 16], [17, 17]],
48 [[20, 20], [21, 21], [22, 22]],
49 ]) # M x K x D
50
51 sigma = np.zeros((M, K, D, D))
52 for m in range(M):
53 for k in range(K):
54 sigma[m,k] = np.eye(D)
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()

Callers 3

fake_signalFunction · 0.90
fake_signalFunction · 0.90
fake_signalFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected