Jim Lynch Codes
  • Blog
  • About Jim

Writings about one coder's stories & experiences.

Baseball Predictor TensorFlow ML Idea

2/10/2019

0 Comments

 
This is just a proof of concept right now, but I basically want to create a little dashboard in ther browser that will follow live baseball games and, in real-time, show the probabilities of each outcome of each player's next at-bat. Then you can look at the numbers of your chart for who's about to be up and easily to compare it to bets available at your sportsbook, and this should then allow you to always bet at a theoretical advantage.

Bets Available

This webpage has a nice description of various baseball in-game bets that are available. There is normally a "money-line" type bet on whether the next at-bat will be a hit (for example, the line would be expressed at +300, meaning you bet $100 to win $300 if it's a single or better). There are sometimes other options to bet on for the at-bat outcome such as betting on a strikeout, fly ball, or walk as well as being able to specify what type of hit. Another thing to note is that this type of sports betting (and really sports betting in general) just recently became legal in the new jersey and new york area, meaning that it's still in its infancy and may be exposing some ripe dollar-fruit to be picked off by sharks.

Data Source

It's very convenient that MySportsFeeds exposes a free api (including a real-time api!) that we can use as the data source for the application and possibly not even need our own backend server. MySportsFeeds provides many different real-time streams that can be useful in predicting the probability of a hit such as: Scoreboard, Game BoxScore, Player Game Logs, Team Game Logs, Active Players, and Daily Player Stats. Of course open source is not always the most accurate / reliable, and we should give an open mind long term on paid data sources if this starts to become a legit revenue-generating thing.  

The Algorithm

I am very excited that tensorflow now has a JavaScript library, and this example is extremely similar to what I want to do here (although the example is in python so please excuse the ugly underscore-happy syntax 😂😂). Our baseball predictor is trying to solve a regression problem, well many regression problems, as it simultaneously predicts the probabilities of various at-bat outcomes for every player's next at bat, on both teams, continuously! In theory we should be able to just feed in the data from MySportsFeeds and so what it predicts!

Ok Then

This was all just an idea I had, but actually writing out this blog post has really made me realize that this is definitely a doable project and could potentially work super well. I have to make a tough decision in terms of React vs Angular here because I've been using React for a while, but with all the streaming and data subscriptions maybe the observable-based Angular would be cleaner and easier to implement. With me luck, and let me know if you are working on anything similar! 😉
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...
    Picture
    Follow @JimLynchCodes
    Follow @JimLynchCodes

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blockchain
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Investing
    Java
    Javascript
    Lean
    Life
    Linux
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Rust
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    March 2023
    August 2021
    February 2021
    January 2021
    October 2020
    September 2020
    May 2020
    April 2020
    February 2020
    January 2020
    December 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim
JimLynchCodes © 2023