Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Error when testing Multi-Output Regression example code #15

Closed
sreedta8 opened this issue Feb 15, 2022 · 7 comments
Closed

Assertion Error when testing Multi-Output Regression example code #15

sreedta8 opened this issue Feb 15, 2022 · 7 comments

Comments

@sreedta8
Copy link

sreedta8 commented Feb 15, 2022

Hi @JohnGoertz

I began testing gumbi on Windows 10 and Windows 10 WSL2. My configuration needs some work for Windows 10 it appears from a compiler point of view. On WSL2 (using Ubuntu 20.04 LTS with gcc 9.3.0), the basic example (see the code below) runs without any errors.

gp.fit(outputs=['mpg'], continuous_dims=['horsepower'])
X = gp.prepare_grid()
y = gp.predict_grid()
gmb.ParrayPlotter(X, y).plot()
sns.scatterplot(data=cars, x='horsepower', y='mpg', color=sns.cubehelix_palette()[-1], alpha=0.5);```


Based on your suggestion from [https://discourse.pymc.io/t/introducing-gumbi-the-gaussian-process-model-building-interface/8377/5](url) I next tested the Multi-Output Regression example code with the Cars data set.

```gp.fit(outputs=['mpg', 'acceleration'], continuous_dims=['horsepower']);
X = gp.prepare_grid()
Y = gp.predict_grid()
axs = plt.subplots(2,1, figsize=(6, 8))[1]
for ax, output in zip(axs, gp.outputs):
    y = Y.get(output)
    gmb.ParrayPlotter(X, y).plot(ax=ax)
    sns.scatterplot(data=cars, x='horsepower', y=output, color=sns.cubehelix_palette()[-1], alpha=0.5, ax=ax);```

I get the following **Assertion Error**. See the full trace back below:

AssertionError                            Traceback (most recent call last)
Input In [8], in <module>
----> 1 gp.fit(outputs=['mpg', 'acceleration'], continuous_dims=['horsepower'])
      3 X = gp.prepare_grid()
      4 Y = gp.predict_grid()

File ~/miniconda3/envs/gumbi_env/lib/python3.10/site-packages/gumbi/regression/GP_pymc3.py:292, in GP.fit(self, outputs, linear_dims, continuous_dims, continuous_levels, continuous_coords, categorical_dims, categorical_levels, additive, seed, heteroskedastic_inputs, heteroskedastic_outputs, sparse, n_u, **MAP_kwargs)
    234 """Fits a GP surface
    235 
    236 Parses inputs, compiles a Pymc3 model, then finds the MAP value for the hyperparameters. `{}_dims` arguments
   (...)
    284 self : :class:`GP`
    285 """
    287 self.specify_model(outputs=outputs, linear_dims=linear_dims, continuous_dims=continuous_dims,
    288                    continuous_levels=continuous_levels, continuous_coords=continuous_coords,
    289                    categorical_dims=categorical_dims, categorical_levels=categorical_levels,
    290                    additive=additive)
--> 292 self.build_model(seed=seed,
    293                  heteroskedastic_inputs=heteroskedastic_inputs,
    294                  heteroskedastic_outputs=heteroskedastic_outputs,
    295                  sparse=sparse, n_u=n_u)
    297 self.find_MAP(**MAP_kwargs)
    299 return self

File ~/miniconda3/envs/gumbi_env/lib/python3.10/site-packages/gumbi/regression/GP_pymc3.py:363, in GP.build_model(self, seed, continuous_kernel, heteroskedastic_inputs, heteroskedastic_outputs, sparse, n_u)
    360 n_p = len(self.outputs)
    362 D_in = len(self.dims)
--> 363 assert X.shape[1] == D_in
    365 idx_l = [self.dims.index(dim) for dim in self.linear_dims]
    366 idx_s = [self.dims.index(dim) for dim in self.continuous_dims]

AssertionError: 

What am I doing wrong? Or is this related to any of the `numpy > 1.19.3` errors (does not look like that)?

Sree
@JohnGoertz
Copy link
Owner

Nope, this was a bug I introduced. Thanks for catching it! It should be fixed now in the latest release (0.1.8).

@sreedta8
Copy link
Author

@JohnGoertz thanks for quick clarification. I will update!

@sreedta8
Copy link
Author

@JohnGoertz After uninstalling gumbi=0.1.7 I tried to run pip install gumbi on my WSL2 setup and I get the following error:

Collecting gumbi
  Using cached gumbi-0.1.8.tar.gz (2.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-l5f7pxo7/gumbi_32d6e6d299bf41f7aa227f66bd13669a/setup.py", line 22, in <module>
          with open(VERSION, encoding="utf-8") as f:
      FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-l5f7pxo7/gumbi_32d6e6d299bf41f7aa227f66bd13669a/VERSION'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.```

@JohnGoertz
Copy link
Owner

Ah, I'll fix that. Thanks for bearing with me!

@JohnGoertz JohnGoertz reopened this Feb 16, 2022
@sreedta8
Copy link
Author

@JohnGoertz you are doing all of the hard work. I would like to see more folks know about your package and use it for modeling. Any help I can provide I would gladly do so! I will definitely wait!

@JohnGoertz
Copy link
Owner

Okay, the latest version on PyPI (0.1.9) should fix that!

@sreedta8
Copy link
Author

@JohnGoertz I have installed gumbi 0.1.9 successfully. As I test the functionality, I plan to create a Jupyter Notebook which I will share here once ready. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants