christopherjenness / NBA-prediction

Predict scores of NBA games using regularized matrix completion
152 stars 43 forks source link

Somes error #7

Closed PrincesseLulu closed 3 years ago

PrincesseLulu commented 5 years ago

Hi i have somes errors and i don't understend it. I think maybe it's linked to my installation softImpute i'm not sure how install it

Note: Also requires softImpute R package install.packages('softImpute')

This never generate predictions.csv file but it have turn on True the update.

Can you help me please ? Thanks for your work it's pretty good :100:

('****', 'http://www.basketball-reference.com/leagues/NBA_2017_games-october.html')
/home/lucas/.local/lib/python2.7/site-packages/pandas/core/indexing.py:117: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._setitem_with_indexer(indexer, value)
Traceback (most recent call last):
  File "model.py", line 223, in <module>
    model = NBAModel(update=True)
  File "model.py", line 51, in __init__
    self.soft_impute()
  File "model.py", line 189, in soft_impute
    subprocess.check_output(['Rscript', './model/predict_soft_impute.R'])
  File "/usr/lib/python2.7/subprocess.py", line 216, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

I have try with Python3 and Python3 project branch and i have it


**** http://www.basketball-reference.com/leagues/NBA_2017_games-october.html
**** http://www.basketball-reference.com/leagues/NBA_2017_games-november.html
**** http://www.basketball-reference.com/leagues/NBA_2017_games-december.html
  Unnamed: 0_level_0 Unnamed: 1_level_0  ... Four Factors Unnamed: 6_level_0
  Unnamed: 0_level_1               Pace  ...       FT/FGA               ORtg
0                NYK               99.9  ...        0.172               88.1
1                CLE               99.9  ...        0.149              117.1

[2 rows x 7 columns]
Traceback (most recent call last):
  File "/home/lucas/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2656, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 987, in pandas._libs.hashtable.Int64HashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 993, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "model.py", line 228, in <module>
    model = NBAModel(update=True)
  File "model.py", line 52, in __init__
    self.df_pace, self.df_OR = self.make_matrices()
  File "model.py", line 179, in make_matrices
    df_pace, df_OR = self.full_update(url, df_pace, df_OR)
  File "model.py", line 162, in full_update
    team1, team2, team1_OR, team2_OR, pace = self.extract_data(table)
  File "model.py", line 140, in extract_data
    team1 = table.loc[2][0]
  File "/home/lucas/.local/lib/python3.6/site-packages/pandas/core/indexing.py", line 1500, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/home/lucas/.local/lib/python3.6/site-packages/pandas/core/indexing.py", line 1913, in _getitem_axis
    return self._get_label(key, axis=axis)
  File "/home/lucas/.local/lib/python3.6/site-packages/pandas/core/indexing.py", line 141, in _get_label
    return self.obj._xs(label, axis=axis)
  File "/home/lucas/.local/lib/python3.6/site-packages/pandas/core/generic.py", line 3585, in xs
    loc = self.index.get_loc(key)
  File "/home/lucas/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2658, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 987, in pandas._libs.hashtable.Int64HashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 993, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 2```