Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

glmnet/fortran error when running yatsm line #82

Closed
parevalo opened this issue Mar 7, 2016 · 4 comments
Closed

glmnet/fortran error when running yatsm line #82

parevalo opened this issue Mar 7, 2016 · 4 comments

Comments

@parevalo
Copy link
Contributor

parevalo commented Mar 7, 2016

I'm trying to run yatsm line and getting the following error:

15:15:19:INFO:51:line.line:Job 1 of 400 - using config file /projectnb/landsat/projects/Colombia/images/005057/Results/FIT1/557_FIT1.yaml
0-th dimension must be fixed to 4 but got 6

Traceback (most recent call last):
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/bin/yatsm", line 9, in <module>
    load_entry_point('yatsm==0.6.0.dev0', 'console_scripts', 'yatsm')()
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/yatsm/cli/line.py", line 156, in line
    yatsm.fit(_X, _Y, _dates, **algo_cfg.get('fit', {}))
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/yatsm/algorithms/ccdc.py", line 222, in fit
    self.train()
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/yatsm/algorithms/ccdc.py", line 326, in train
    bands=self.test_indices)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/yatsm/algorithms/yatsm.py", line 195, in fit_models
    model.fit(X, y, **self.estimator_fit)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/glmnet/elastic_net.py", line 86, in fit
    enet_path(X, y, alpha=self.alpha, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/glmnet/elastic_net.py", line 349, in enet_path
    = elastic_net(X, y, alpha, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/glmnet/glmnet.py", line 91, in elastic_net
    nlam=nlam, isd=standardize)
_glmnet.error: failed in converting 6th argument `vp' of _glmnet.elnet to C/Fortran array
  • I'm using a conda venv and packages were installed during its creation, using the environment.yaml file and following the instructions provided in the documentation.
  • I'm using yatsm 0.6.0dev (very latest version)
  • Config files in: /projectnb/landsat/projects/Colombia/images/005057/Results/FIT1
  • The script used is Yatsm.sh

I'm not even sure how to try to debug it myself or trace the cause of the problem. Also, I checked your glmnet-python repository and you suggested using the fork by the user "shuras" and tried to install that to see if it fixed the problem but the installation was unsuccessful.

@ceholden
Copy link
Owner

ceholden commented Mar 8, 2016

Yeah that recommendation is for other users. My fork, specifically, is a dependency of YATSM and is the only one that works similar enough to sklearn to be useful.

I don't have read permissions to view your Python installation files but I'd be happy to take a look tomorrow in person. My guesses are either:

  1. Maybe glmnet dependency is out of date
  2. Pickle could be out of date. The version of the code in the pickle you're trying to import needs to be the same version as the code you're trying to run.
  3. A bug in parsing your weights

I'll have to check, but I think you can use one of the pickles built when you install YATSM alongside fit options. Looks like I check for the actual pickle file being "built-in" to YATSM before I go looking for it where the user specifies in config_parser.py. If not, change it to allow:

YATSM:
    prediction: BUILT_IN_ESTIMATOR

...
BUILT_IN_ESTIMATOR:
    # no need to specify since it's included in package
    # pickle: some_file.pkl
    fit:
        penalties: [1, 1, 1, 1, 1, 1]

@parevalo
Copy link
Contributor Author

parevalo commented Mar 8, 2016

Ahh, the problem must be the pickle version then. I wasn't aware that they
needed to be the same version, I was just lazy and used the same ones that
were available for release 0.5.5. The reason why I used those was because
there seemed to be no "pre-built" pickles in your latest version.

On Mon, Mar 7, 2016 at 9:11 PM, Chris Holden [email protected]
wrote:

Yeah that recommendation is for other users. My fork, specifically, is a
dependency of YATSM and is the only one that works similar enough to
sklearn to be useful.

I don't have read permissions to view your Python installation files but
I'd be happy to take a look tomorrow in person. My guesses are either:

  1. Maybe glmnet dependency is out of date
  2. Pickle could be out of date. The version of the code in the pickle
    you're trying to import needs to be the same version as the code you're
    trying to run.
  3. A bug in parsing your weights

I'll have to check, but I think you can use one of the pickles built when
you install YATSM alongside fit options. Looks like I check for the actual
pickle file being "built-in" to YATSM before I go looking for it where the
user specifies in config_parser.py. If not, change it to allow:

YATSM:
prediction: BUILT_IN_ESTIMATOR

...BUILT_IN_ESTIMATOR:
# no need to specify since it's included in package
# pickle: some_file.pkl
fit:
penalties: [1, 1, 1, 1, 1, 1]


Reply to this email directly or view it on GitHub
#82 (comment).

@ceholden
Copy link
Owner

ceholden commented Mar 8, 2016

OK let's make sure it's the problem tomorrow then and I'll try to write up something instructive.

What you're basically a victim of a transition out of a bad design decision. There's a good Python talk on YouTube on science model serialization I'll try to dig up that is relevant to this discussion, but I haven't found it just yet.

@ceholden
Copy link
Owner

Issue resolved. Configuration file in question used 4 coefficients but specified 6 penalties for Lasso.

Follow up: document model fit option specification in configuration docs (#37)

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

No branches or pull requests

2 participants