gregbellan / Stabl

BSD 3-Clause Clear License
43 stars 10 forks source link

Error Run notebooks without some estimators #11

Closed lazaromsanchezr closed 4 months ago

lazaromsanchezr commented 4 months ago

Hello

I have noticed ElasticNet (EN) method is computationally expensive. Since I'm only planning to use results with Lasso, I commented the lines that refer to EN in the provided notebook examples. For instance:

estimators = {
    "lasso": lasso_cv,
    "alasso": alasso_cv,
   # "en": en_cv,
   # "sgl": sgl_cv,
    "stabl_lasso": stabl,
    "stabl_alasso": stabl_alasso,
 #   "stabl_en": stabl_en,
 #   "stabl_sgl": stabl_sgl,
}

However, this results in an error. Please, see below:

Run CV on SSI dataset
Traceback (most recent call last):
  File "\someaddress\Stabl\Notebook examples\run_cv_SSI_modified.py", line 113, in <module>
    multi_omic_stabl_cv(
  File "\someaddress\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\sklearn\utils\_testing.py", line 158, in wrapper
    return fn(*args, **kwargs)
  File "\someaddress\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\stabl\multi_omic_pipelines.py", line 144, in multi_omic_stabl_cv
    en = estimators["en"]
KeyError: 'en'
xavdurand commented 4 months ago

Hello @lazaromsanchezr ,

If you want to remove some models from the run, you just need to comment their names in the variable models. You have to keep them uncommented in the variable estimators. For example, in the file run_cv_CFRNA.py, the variable models is set to:

# Associated model names. Here you can comment what you don't want to test ()
models = [
    "STABL Lasso",
    "Lasso",
    "STABL ALasso",
    "ALasso",
    # "STABL ElasticNet",
    # "ElasticNet"
]

So both ElasticNet models are not used.

I hope it is more clear now.

PS: I change the name of the issue so it is more adequate to the error.

lazaromsanchezr commented 4 months ago

Hi Xavier,

Thank you, that worked!