Skip to content

Value error when running the nascar example #12

@juliagorman

Description

@juliagorman

I was just trying to run rSLDS on the NASCAR example by just running in a notebook cell
% run examples/nascar.py as instructed by the tutorial.

I then got this error:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.

with this being the whole error message:

`Setting seed to 0

ValueError Traceback (most recent call last)
File /mnt/cube/jugorman/rSLDS/recurrent-slds/examples/nascar.py:581
576 plt.show()
579 if name == "main":
580 # Simulate NASCAR data
--> 581 true_model, inputs, z_true, x_true, y, mask = simulate_nascar()
583 # Run PCA to get 2D dynamics
584 x_init, C_init = fit_pca(y)

File /mnt/cube/jugorman/rSLDS/recurrent-slds/examples/nascar.py:136, in simulate_nascar()
133 reg_b += mu_b[:,None]
135 # Make a recurrent SLDS with these params #
--> 136 dynamics_distns = [
137 Regression(
138 A=np.column_stack((A,b)),
139 sigma=1e-4 * np.eye(D_latent),
140 nu_0=D_latent + 2,
141 S_0=1e-4 * np.eye(D_latent),
142 M_0=np.zeros((D_latent, D_latent + 1)),
143 K_0=np.eye(D_latent + 1),
144 )
145 for A,b in zip(As, bs)]
147 init_dynamics_distns = [
148 Gaussian(
149 mu=np.array([0.0, 1.0]),
150 sigma=1e-3 * np.eye(D_latent))
151 for _ in range(K_true)]
153 C = np.hstack((npr.randn(args.D_obs, D_latent), np.zeros((args.D_obs, 1))))

File /mnt/cube/jugorman/rSLDS/recurrent-slds/examples/nascar.py:137, in (.0)
133 reg_b += mu_b[:,None]
135 # Make a recurrent SLDS with these params #
136 dynamics_distns = [
--> 137 Regression(
138 A=np.column_stack((A,b)),
139 sigma=1e-4 * np.eye(D_latent),
140 nu_0=D_latent + 2,
141 S_0=1e-4 * np.eye(D_latent),
142 M_0=np.zeros((D_latent, D_latent + 1)),
143 K_0=np.eye(D_latent + 1),
144 )
145 for A,b in zip(As, bs)]
147 init_dynamics_distns = [
148 Gaussian(
149 mu=np.array([0.0, 1.0]),
150 sigma=1e-3 * np.eye(D_latent))
151 for _ in range(K_true)]
153 C = np.hstack((npr.randn(args.D_obs, D_latent), np.zeros((args.D_obs, 1))))

File /mnt/cube/jugorman/envs/rSLDS/lib/python3.8/site-packages/pybasicbayes/distributions/regression.py:36, in Regression.init(self, nu_0, S_0, M_0, K_0, affine, A, sigma)
32 have_hypers = not any_none(nu_0,S_0,M_0,K_0)
34 if have_hypers:
35 self.natural_hypparam = self.mf_natural_hypparam =
---> 36 self._standard_to_natural(nu_0,S_0,M_0,K_0)
38 if A is sigma is None and have_hypers:
39 self.resample()

File /mnt/cube/jugorman/envs/rSLDS/lib/python3.8/site-packages/pybasicbayes/distributions/regression.py:85, in Regression._standard_to_natural(nu, S, M, K)
83 C = Kinv
84 d = nu
---> 85 return np.array([A,B,C,d])`

All I have done is just downloaded the required packages and tried to run the example as it currently is

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions