deprekate / prfect

Software to predict the occurence of programmed ribosomal frameshifting in bacterial, phage, and viral genomes
GNU General Public License v3.0
7 stars 1 forks source link

AttributeError: 'HistGradientBoostingClassifier' object has no attribute '_preprocessor' #4

Closed AD-git1 closed 5 months ago

AD-git1 commented 5 months ago

When running prfect.py prfect/test/covid19.gbk, I get the following error:

Error Traceback (most recent call last): File "/home/sc-linux1/miniconda3/envs/prfect2/bin/prfect.py", line 181, in if has_prf(metrics): ^^^^^^^^^^^^^^^^ File "/home/sc-linux1/miniconda3/envs/prfect2/bin/prfect.py", line 141, in has_prf prob = clf.predict_proba(row.loc[:,clf.feature_namesin]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sc-linux1/miniconda3/envs/prfect2/lib/python3.12/site-packages/sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py", line 2178, in predict_proba raw_predictions = self._raw_predict(X) ^^^^^^^^^^^^^^^^^^^^ File "/home/sc-linux1/miniconda3/envs/prfect2/lib/python3.12/site-packages/sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py", line 1264, in _raw_predict X = self._preprocess_X(X, reset=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sc-linux1/miniconda3/envs/prfect2/lib/python3.12/site-packages/sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py", line 266, in _preprocess_X if self._preprocessor is None: ^^^^^^^^^^^^^^^^^^ AttributeError: 'HistGradientBoostingClassifier' object has no attribute '_preprocessor'. Did you mean: '_preprocess_X'?

My environment: _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge bzip2 1.0.8 hd590300_5 conda-forge ca-certificates 2023.11.17 hbcca054_0 conda-forge genbank 0.110 pypi_0 pypi hotknots 2.4 pypi_0 pypi joblib 1.3.2 pypi_0 pypi ld_impl_linux-64 2.40 h41732ed_0 conda-forge libexpat 2.5.0 hcb278e6_1 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.2.0 h807b86a_4 conda-forge libgomp 13.2.0 h807b86a_4 conda-forge libnsl 2.0.1 hd590300_0 conda-forge libsqlite 3.44.2 h2797004_0 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libxcrypt 4.4.36 hd590300_1 conda-forge libzlib 1.2.13 hd590300_5 conda-forge linearfold 1.1 pypi_0 pypi ncurses 6.4 h59595ed_2 conda-forge numpy 1.26.3 pypi_0 pypi openssl 3.2.0 hd590300_1 conda-forge packaging 23.2 pypi_0 pypi pandas 2.2.0 pypi_0 pypi pip 23.3.2 pyhd8ed1ab_0 conda-forge prfect 0.38 pypi_0 pypi python 3.12.1 hab00c5b_1_cpython conda-forge python-dateutil 2.8.2 pypi_0 pypi pytz 2023.4 pypi_0 pypi readline 8.2 h8228510_1 conda-forge scikit-learn 1.4.0 pypi_0 pypi scipy 1.12.0 pypi_0 pypi score-rbs 0.5 pypi_0 pypi setuptools 69.0.3 pyhd8ed1ab_0 conda-forge six 1.16.0 pypi_0 pypi sklearn 0.0.post12 pypi_0 pypi threadpoolctl 3.2.0 pypi_0 pypi tk 8.6.13 noxft_h4845f30_101 conda-forge tzdata 2023.4 pypi_0 pypi wheel 0.42.0 pyhd8ed1ab_0 conda-forge xz 5.2.6 h166bdaf_0 conda-forge

keith-harrison commented 5 months ago

Hi! There are some issues I found with the requirements file. Download the prfect program/folder to somewhere you can use it and do the following.

  1. Extract folder

  2. go into the setup.py and setup the requirements like this instead, it needs to be scikit-learn==1.1.1 to work!: install_requires=['scikit-learn==1.1.1','numpy','pandas','genbank','LinearFold','hotknots','score_rbs', 'packaging'],

  3. Create (needs to be a new one) a new conda/mamba environment and recompile the python code :D

mamba create -n new_env mamba activate new_env cd prfect make python /prfect/prfect.py /data/Atkins/gbk/AM111097.gbk.gz I found this worked well! This is because sci-kit learns newest package is downloaded which it does not work with it also does not like sklearn being in the requirements list :)

vlnj201 commented 5 months ago

Thanks - this worked for me!

AD-git1 commented 5 months ago

Thanks! It worked for me as well