Git Product home page Git Product logo

football's Introduction

Fantasy Football Predictor

The draft was approaching. I knew web scraping and how to do machine learning regressions using scikit-learn. It seemed only natural to try and game out my picks in one way or another.

I scrape the website https://www.pro-football-reference.com/ for this project.

There's a massive tutorial to explain all this that I wrote located here:

http://www.kingzephyr.com/2019/09/13/fantasy-football-with-scrapy-and-scikit-learn-part-1/

http://www.kingzephyr.com/2019/09/13/fantasy-football-with-scrapy-and-scikit-learn-part-2/

Prerequisites

I am assuming Python 3 is installed on the system, as well as Git.

To run the code

TLDR: Assuming everything works as expected, the full script should be

cd ~
mkdir project
cd project

python -m venv football_venv
source football_venv/bin/activate

git clone https://github.com/athompson1991/football.git
cd football

pip install -r requirements.txt

mkdir script/data

scrapy crawl passing
scrapy crawl receiving
scrapy crawl defense
scrapy crawl kicking

cd script
python run_script.py
Step-by-Step

Navigate to an empty directory.

cd ~
mkdir project
cd project

Now make your Python environment and activate said environment.

python -m venv football_venv
source football_venv/bin/activate

Clone this repo to your local machine, then cd into the directory

git clone https://github.com/athompson1991/football.git
cd football

Install requirements

pip install -r requirements.txt

Now for the fun part. The project requires a directory to store the data, so make the directory in the proper location

mkdir script/data

Scrape all the data

scrapy crawl passing
scrapy crawl receiving
scrapy crawl passing

This scrapes the website and saves our "database" as csv files to the directory we just made.

Now simply run the script to crunch all the numbers

cd script
python run_script.py

That should do it! Once the script runs all the way through, there should be a power_rankings.csv file in your script/data directory. This means that the script successfully fit and tuned 21 regression models, then used those models to produce a power ranking.

football's People

Contributors

athompson1991 avatar

Watchers

 avatar

Forkers

anvt

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.