Giter VIP home page Giter VIP logo

octosport / octopy Goto Github PK

View Code? Open in Web Editor NEW
61.0 2.0 26.0 399 KB

Python implementation of various soccer/football analytics methods such as Poisson goals prediction, Shin method, machine learning prediction... This is a companion python module for octosport medium blog.

Home Page: https://www.octosport.io/

License: MIT License

Python 8.52% Jupyter Notebook 91.48%
football poisson-distribution prediction-model shin-method implied-odds soccer-prediction power-method machine-learning soccer-analytics elo-rating

octopy's People

Contributors

octosport avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

octopy's Issues

NHL Data -> gradient goes NaN

Hi there,
I've played around with the code, but after a few iterations, the gradient becomes NaN and some iterations later all values are becoming NaNs. I've tried to debug the formulas, but yet I couldn't identify the real ploblem.
It works fine with soccer scores, but maybe you can have a look on this problem with NHL scores.
To recreate the problem, you can get the data like this:

import requests
import sys
import csv
from datetime import datetime

path = sys.path[0]
path += "/"

startDate = "2021-10-07"
endDate = datetime.today().strftime('%Y-%m-%d')
url = "https://statsapi.web.nhl.com/api/v1/schedule?startDate="+startDate+"&endDate="+endDate

game = [date,home,away,home_goals,away_goals]

games = []

response = requests.get(url)
data = response.json()

for d in data['dates']:
for game in d['games']:
if game['status']['detailedState'] == "Final":
games.append([game['gameDate'][:10], game['teams']['home']['team']['name'], game['teams']['away']['team']['name'], float(game['teams']['home']['score']), float(game['teams']['away']['score'])])

with open(path+'nhl_results.csv', 'w', newline='') as f:
write = csv.writer(f)
write.writerow(["date", "home", "away", "home_goals", "away_goals"])
write.writerows(games)

----- And you can import the data like this:
data = pd.read_csv('nhl_results.csv', encoding='ISO-8859-1')

Best regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.