kyleskom / NBA-Machine-Learning-Sports-Betting

NBA sports betting using machine learning
1.16k stars 431 forks source link

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' #206

Closed MegaH01 closed 11 months ago

MegaH01 commented 1 year ago

This is not a time of day issue. When running locally I get this error. When running from google colab it works fine. I can run it at 6AM or 6PM and the same error appears but always works on google colab. Also gives me hte same error for betmgm, fanduel, etc

Any ideas?

python3 main.py -A -odds=betmgm 2023-04-22 07:31:34.536645: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-04-22 07:31:34.576855: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-04-22 07:31:34.577136: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-04-22 07:31:35.081499: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2023-04-22 07:31:35.728956: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:996] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 2023-04-22 07:31:35.729279: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1956] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... ------------------betmgm odds data------------------ Philadelphia 76ers (None) @ Brooklyn Nets (None) Phoenix Suns (None) @ LA Clippers (None) Milwaukee Bucks (None) @ Miami Heat (None) Memphis Grizzlies (None) @ Los Angeles Lakers (None) ---------------XGBoost Model Predictions--------------- Brooklyn Nets vs Philadelphia 76ers (53.5%): OVER None (84.2%) LA Clippers (56.0%) vs Phoenix Suns: OVER None (93.2%) Miami Heat vs Milwaukee Bucks (52.6%): OVER None (92.3%) Los Angeles Lakers vs Memphis Grizzlies (52.3%): OVER None (88.6%) --------------------Expected Value--------------------- Brooklyn Nets EV: 0 Philadelphia 76ers EV: 0 LA Clippers EV: 0 Phoenix Suns EV: 0 Miami Heat EV: 0 Milwaukee Bucks EV: 0 Los Angeles Lakers EV: 0 Memphis Grizzlies EV: 0

------------Neural Network Model Predictions----------- 1/1 [==============================] - 0s 74ms/step 1/1 [==============================] - 0s 12ms/step 1/1 [==============================] - 0s 11ms/step 1/1 [==============================] - 0s 11ms/step 1/1 [==============================] - 0s 26ms/step 1/1 [==============================] - 0s 11ms/step 1/1 [==============================] - 0s 10ms/step 1/1 [==============================] - 0s 10ms/step Brooklyn Nets (53.5%) vs Philadelphia 76ers: UNDER None (nan%) LA Clippers (58.2%) vs Phoenix Suns: UNDER None (nan%) Miami Heat vs Milwaukee Bucks (58.0%): UNDER None (nan%) Los Angeles Lakers (50.7%) vs Memphis Grizzlies: UNDER None (nan%) --------------------Expected Value--------------------- Traceback (most recent call last): File "/root/nba/main.py", line 131, in main() File "/root/nba/main.py", line 120, in main NN_Runner.nn_runner(data, todays_games_uo, frame_ml, games, home_team_odds, away_team_odds) File "/root/nba/src/Predict/NN_Runner.py", line 66, in nn_runner ev_home = float(Expected_Value.expected_value(ml_predictions_array[count][0][1], int(home_team_odds[count]))) TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

chriseling commented 1 year ago

It could still be a time of day issue since I believe Google co lab runs on UTC time (based in England)

On Sat, Apr 22, 2023 at 4:34 AM MegaH01 @.***> wrote:

This is not a time of day issue. When running locally I get this error. When running from google colab it works fine. I can run it at 6AM or 6PM and the same error appears but always works on google colab. Also gives me hte same error for betmgm, fanduel, etc

Any ideas? python3 main.py -A -odds=betmgm 2023-04-22 07:31:34.536645: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-04-22 07:31:34.576855: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-04-22 07:31:34.577136: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-04-22 07:31:35.081499: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2023-04-22 07:31:35.728956: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:996] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 2023-04-22 07:31:35.729279: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1956] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... ------------------betmgm odds data------------------ Philadelphia 76ers (None) @ Brooklyn Nets (None) Phoenix Suns (None) @ LA Clippers (None) Milwaukee Bucks (None) @ Miami Heat (None) Memphis Grizzlies (None) @ Los Angeles Lakers (None) ---------------XGBoost Model Predictions--------------- Brooklyn Nets vs Philadelphia 76ers (53.5%): OVER None (84.2%) LA Clippers (56.0%) vs Phoenix Suns: OVER None (93.2%) Miami Heat vs Milwaukee Bucks (52.6%): OVER None (92.3%) Los Angeles Lakers vs Memphis Grizzlies (52.3%): OVER None (88.6%) --------------------Expected Value--------------------- Brooklyn Nets EV: 0 Philadelphia 76ers EV: 0 LA Clippers EV: 0 Phoenix Suns EV: 0 Miami Heat EV: 0 Milwaukee Bucks EV: 0 Los Angeles Lakers EV: 0 Memphis Grizzlies EV: 0

------------Neural Network Model Predictions----------- 1/1 [==============================] - 0s 74ms/step 1/1 [==============================] - 0s 12ms/step 1/1 [==============================] - 0s 11ms/step 1/1 [==============================] - 0s 11ms/step 1/1 [==============================] - 0s 26ms/step 1/1 [==============================] - 0s 11ms/step 1/1 [==============================] - 0s 10ms/step 1/1 [==============================] - 0s 10ms/step Brooklyn Nets (53.5%) vs Philadelphia 76ers: UNDER None (nan%) LA Clippers (58.2%) vs Phoenix Suns: UNDER None (nan%) Miami Heat vs Milwaukee Bucks (58.0%): UNDER None (nan%) Los Angeles Lakers (50.7%) vs Memphis Grizzlies: UNDER None (nan%) --------------------Expected Value--------------------- Traceback (most recent call last): File "/root/nba/main.py", line 131, in main() File "/root/nba/main.py", line 120, in main NN_Runner.nn_runner(data, todays_games_uo, frame_ml, games, home_team_odds, away_team_odds) File "/root/nba/src/Predict/NN_Runner.py", line 66, in nn_runner ev_home = float(Expected_Value.expected_value(ml_predictions_array[count][0][1], int(home_team_odds[count]))) TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

— Reply to this email directly, view it on GitHub https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting/issues/206, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVP5W6G2B6XGCSINHOM5ELXCO65ZANCNFSM6AAAAAAXHY5XPY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Best, Chris

Venners09 commented 1 year ago

I have a feeling this is some time of day issue, possibly similar to above. It works fine in Google Colab but when i run it from command prompt it doesn't pull through any odds and when I run it without the -odds argument it's showing games for Monday night rather than tonight's games. Is there anyway to fix this locally?

C:\Users\steph\Documents\NBA\NBA-Machine-Learning-Sports-Betting>py main.py -xgb -odds=fanduel
C:\Users\steph\AppData\Local\Programs\Python\Python39\lib\site-packages\keras\saving\legacy\saved_model\load.py:110: RuntimeWarning: Unexpected end-group tag: Not all data was converted
  metadata.ParseFromString(file_content)
2023-05-07 12:04:26.491155: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
------------------fanduel odds data------------------
Boston Celtics (None) @ Philadelphia 76ers (None)
Denver Nuggets (None) @ Phoenix Suns (None)
---------------XGBoost Model Predictions---------------
Philadelphia 76ers (51.8%) vs Boston Celtics: OVER None (86.4%)
Phoenix Suns (51.0%) vs Denver Nuggets: OVER None (97.6%)
---------------------Expected Value--------------------
Traceback (most recent call last):
  File "C:\Users\steph\Documents\NBA\NBA-Machine-Learning-Sports-Betting\main.py", line 132, in <module>
    main()
  File "C:\Users\steph\Documents\NBA\NBA-Machine-Learning-Sports-Betting\main.py", line 112, in main
    XGBoost_Runner.xgb_runner(data, todays_games_uo, frame_ml, games, home_team_odds, away_team_odds, args.kc)
  File "C:\Users\steph\Documents\NBA\NBA-Machine-Learning-Sports-Betting\src\Predict\XGBoost_Runner.py", line 89, in xgb_runner
    bankroll_fraction_home = bankroll_descriptor + str(kc.calculate_kelly_criterion(home_team_odds[count], ml_predictions_array[count][0][1])) + '%'
  File "C:\Users\steph\Documents\NBA\NBA-Machine-Learning-Sports-Betting\src\Utils\Kelly_Criterion.py", line 15, in calculate_kelly_criterion
    decimal_odds = american_to_decimal(american_odds)
  File "C:\Users\steph\Documents\NBA\NBA-Machine-Learning-Sports-Betting\src\Utils\Kelly_Criterion.py", line 5, in american_to_decimal
    if american_odds >= 100:
TypeError: '>=' not supported between instances of 'NoneType' and 'int'
Ambrose997 commented 1 year ago

This really needs a reply. I'm experiencing this issue as well and it's as if it's not even pulling the odds from these sites at all, even when trying different sportsbooks. Is 3PM UK time considered too late or something? I've also checked these sites manually and the odds are definitely posted.

kyleskom commented 1 year ago

The season is pretty much over. Im holding off on anything until next season.

Ambrose997 commented 1 year ago

Oh okay, fair enough. I'm not really familiar with NBA so I didn't realize, I just think the bot is cool :).

This is really impressive.

woodayssolutions commented 1 year ago

Did anyone found any alternative to resolve this issue? Any approach we should take care this to work? We tried on google colab also but same above error is coming .Please help on this issue

woodayssolutions commented 1 year ago

@chriseling @kyleskom @MegaH01 @Venners09 Are you able to run this code , i am getting this error "TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'" even by running on google colab also. Requesting you to please suggest if there is any way to resolve this issue and execute the BOT.

Thanks in Advance.

Regards, Nitin