Skip to content

scikit-learn Lasso version error #13

Description

@hhollandmoritz

Hello!

We wanted to let you know about a recent issue we encountered while installing MUSiCC on a new system. After installing the dependencies and MUSiCC in a conda environment, we got this error while running test_muiscc.py

ERROR: test_is_output_correct_for_normalization_correction_learn_model (__main__.MUSiCCTestCase.test_is_output_correct_for_normalization_correction_learn_model)
Does MUSiCC produce the correct output for normalization and correction of the example case?
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/mnt/lz01/ernakovich/heh1030/.conda/envs/MUSiCC/bin/test_musicc.py", line 73, in test_is_output_correct_for_normalization_correction_learn_model
    correct_and_normalize(musicc_args)
  File "/mnt/lz01/ernakovich/heh1030/.conda/envs/MUSiCC/lib/python3.11/site-packages/musicc/core.py", line 351, in correct_and_normalize
    final_model, all_samples_mean_scores[s] = learn_lasso_model(final_covariates, final_response)
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/lz01/ernakovich/heh1030/.conda/envs/MUSiCC/lib/python3.11/site-packages/musicc/core.py", line 77, in learn_lasso_model
    lasso = Lasso(fit_intercept=True, normalize=False, alpha=mean_best_alpha)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Lasso.__init__() got an unexpected keyword argument 'normalize'

After looking into it we realized that this is due to the removal of the "normalize" option in Lasso above version 0.24. (See this documentation: https://scikit-learn.org/1.0/modules/generated/sklearn.linear_model.Lasso.html?highlight=lasso#sklearn.linear_model.Lasso)

As a temporary fix, we specified version 0.24 in our installation of scikit-learn and that solved the problem. We thought we'd let you know so the documentation on the README page can be updated or the normalize command removed from the base code.

Thanks!
Hannah

P.S. Here's our installation process, in case it's helpful to anyone.

conda create -n MUSiCC
conda activate MUSiCC
conda install numpy scipy scikit-learn=0.24.2 pandas pip -y -c conda-forge 
~/.conda/envs/MUSiCC/bin/pip install -U MUSiCC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions