NBA-Predict icon indicating copy to clipboard operation
NBA-Predict copied to clipboard

Newer version of scikit learn

Open jernej19 opened this issue 1 year ago • 2 comments

Hi,

first, this is a great project. Huge thanks for that :)

Second, do you know what do we have to change in the code if we want to use a newer version of scikit learn because currently we get an error saying no module named 'sklearn.linear_model.logistic'

Thanks

jernej19 avatar Oct 20 '22 17:10 jernej19

just install the new version with pip3 install sklearn

chescake avatar Oct 20 '22 18:10 chescake

But I thought it has to be 0.21.2 to work. As I mentioned, I have a 1.1 version installed and I received an error no module named 'sklearn.linear_model.logistic

jernej19 avatar Oct 20 '22 18:10 jernej19

Hi,

first, this is a great project. Huge thanks for that :)

Second, do you know what do we have to change in the code if we want to use a newer version of scikit learn because currently we get an error saying no module named 'sklearn.linear_model.logistic'

Thanks

Hi, I have the same error

228lebron avatar Oct 26 '22 12:10 228lebron

this works for me try pip3 install "scikit_learn==0.22.2.post1" then let me know

Denwen12 avatar Oct 26 '22 13:10 Denwen12

I have the same issue and the installation of 0.22.2 is not available should I create a new model using Createmodel or is there other way to change the .PKL file

error message as follow:

Collecting scikit_learn==0.22.2.post1 Using cached scikit-learn-0.22.2.post1.tar.gz (6.9 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy>=1.11.0 in c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from scikit_learn==0.22.2.post1) (1.23.4) Requirement already satisfied: scipy>=0.17.0 in c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from scikit_learn==0.22.2.post1) (1.6.1) Requirement already satisfied: joblib>=0.11 in c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from scikit_learn==0.22.2.post1) (1.0.1) Installing collected packages: scikit_learn Attempting uninstall: scikit_learn Found existing installation: scikit-learn 0.24.1 Uninstalling scikit-learn-0.24.1: Successfully uninstalled scikit-learn-0.24.1 DEPRECATION: scikit_learn is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for scikit_learn ... error error: subprocess-exited-with-error

× Running setup.py install for scikit_learn did not run successfully.
│ exit code: 1 ╰─> [33 lines of output] Partial import of sklearn during the build process. C:\Windows\Temp\pip-install-j6z6zqkh\scikit-learn_1a2e5be4bd0d4546b1997be16ad664ea\setup.py:123: DeprecationWarning:

    `numpy.distutils` is deprecated since NumPy 1.23.0, as a result     
    of the deprecation of `distutils` itself. It will be removed for    
    Python >= 3.12. For older Python versions it will remain present.   
    It is recommended to use `setuptools < 60.0` for those Python versions.
    For more details, see:
      https://numpy.org/devdocs/reference/distutils_status_migration.html


    from numpy.distutils.command.build_ext import build_ext  # noqa     
  Traceback (most recent call last):
    File "C:\Windows\Temp\pip-install-j6z6zqkh\scikit-learn_1a2e5be4bd0d4546b1997be16ad664ea\sklearn\_build_utils\__init__.py", line 32, in _check_cython_version
      import Cython
  ModuleNotFoundError: No module named 'Cython'

  During handling of the above exception, another exception occurred:   

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Windows\Temp\pip-install-j6z6zqkh\scikit-learn_1a2e5be4bd0d4546b1997be16ad664ea\setup.py", line 303, in <module>
      setup_package()
    File "C:\Windows\Temp\pip-install-j6z6zqkh\scikit-learn_1a2e5be4bd0d4546b1997be16ad664ea\setup.py", line 299, in setup_package
      setup(**metadata)
    File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\distutils\core.py", line 135, in setup
      config = configuration()
    File "C:\Windows\Temp\pip-install-j6z6zqkh\scikit-learn_1a2e5be4bd0d4546b1997be16ad664ea\setup.py", line 180, in configuration
      _check_cython_version()
    File "C:\Windows\Temp\pip-install-j6z6zqkh\scikit-learn_1a2e5be4bd0d4546b1997be16ad664ea\sklearn\_build_utils\__init__.py", line 35, in _check_cython_version
      raise ModuleNotFoundError(message)
  ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. Rolling back uninstall of scikit-learn Moving to c:\users\user\appdata\local\programs\python\python39\lib\site-packages\scikit_learn-0.24.1.dist-info
from C:\Users\user\AppData\Local\Programs\Python\Python39\Lib\site-packages~cikit_learn-0.24.1.dist-info Moving to c:\users\user\appdata\local\programs\python\python39\lib\site-packages\sklearn
from C:\Users\user\AppData\Local\Programs\Python\Python39\Lib\site-packages~klearn error: legacy-install-failure

× Encountered error while trying to install package. ╰─> scikit_learn

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

YHHuan avatar Oct 26 '22 16:10 YHHuan

are you using python3 or python2

Denwen12 avatar Oct 26 '22 16:10 Denwen12

i just ran it and results are below

homeTeamWinProb winProbPercent awayTeamWinProb AwayTeamWinProb
Cleveland Cavaliers 0.8377 Orlando Magic 0.1623
Detroit Pistons 0.3882 Atlanta Hawks 0.6118
New York Knicks 0.5458 Charlotte Bobcats 0.4542
Toronto Raptors 0.6039 Philadelphia 76ers 0.3961
Milwaukee Bucks 0.8002 New Jersey Nets 0.1998
Chicago Bulls 0.6392 Indiana Pacers 0.3608
Minnesota Timberwolves 0.5451 San Antonio Spurs 0.4549
Utah Jazz 0.7733 Houston Rockets 0.2267
Denver Nuggets 0.7117 Los Angeles Lakers 0.2883
Portland Trail Blazers 0.796 Miami Heat 0.204

Denwen12 avatar Oct 26 '22 16:10 Denwen12

my output is different because im using the details for another program i needed decimals..

Denwen12 avatar Oct 26 '22 16:10 Denwen12

I checked the env nd it's python 3.9.2 wat other in do you need?

YHHuan avatar Oct 27 '22 01:10 YHHuan

I think the main error code is this

DEPRECATION: scikit_learn is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

but --use-pep517 doesn't solve it

YHHuan avatar Oct 27 '22 02:10 YHHuan

From what I remember, the logistic regression model in scikit_learn that was used in this project was deprecated some point after 0.21.2. This means that if you want to make sure the code works as is, you'll need to use 0.21.2. If you want to use a different model or something from the more recent scikit versions, you'd likely have to go through and change some of the code in createModel.py.

JakeKandell avatar Nov 07 '22 21:11 JakeKandell

The project works correctly for me..

Denwen12 avatar Nov 07 '22 23:11 Denwen12