lags = 10 # AR Gaussian trans1 = LinearTransformation(K=K, D=D, lags=lags) obs1 = ARGaussianObservation(K=K, D=D, transformation=trans1, train_sigma=False) model1 = HMM(K=K, D=D, observation=obs1) model2 = HMM(K=K, D=D, observation_kwargs={"lags": lags}) #print(model1.params == model2.params) model2.params = model1.params for p1, p2 in zip(model1.params_unpack, model2.params_unpack): assert torch.all(torch.eq(p1, p2)) # AR LogitNormal bounds = np.array([[0, 2], [0, 4]]) model1 = HMM(K=K, D=D, observation='logitnormal', observation_kwargs={ "lags": lags, "bounds": bounds })
D=D, M=M, lags=1, bounds=bounds, transformation=tran) # model model = HMM(K=K, D=D, M=M, observation=obs) #model.observation.mus_init = data[0] * torch.ones(K, D, dtype=torch.float64) params = joblib.load( "/Users/leah/Columbia/courses/19summer/SocialBehavior/SocialBehaviorptc/project_notebooks/gridmodel/model_k2" ) model.params = params obs.log_sigmas = torch.log(torch.ones((2, 4), dtype=torch.float64) * 0.01) center_z = torch.tensor([0], dtype=torch.int) center_x = torch.tensor([[150, 190, 200, 200]], dtype=torch.float64) sample_z_center, sample_x_center = model.sample(20, prefix=(center_z, center_x)) diff = np.diff(sample_x_center, axis=0) print("diff in dim 0") print(diff[:, 0]) print("\ndiff in dim 1")