Giter Club home page Giter Club logo

lineuprecommender's Introduction

LineupRecommender

All of our code can be run from updater.py. updater.py contains a class called DailyUpdate, with a function called get_todays_optimal_lineup(). What this function does is it prepares the csvs with all of the data that we are scraping from stats.nba.com and NumberFire and the data we are getting from the Stattleship API. It prepares all the necessary dictionaries from the csvs and runs the regressor in DailyProjector and obtains the projected scores for all the players playing today. Then it optimizes this lineup to get the best 9 players that would get the highest overall score. This is outlined in updater.py in step 0, 1, 2, and 3.

*** IMPORTANT ***
To run our code without needing to comment out any of the steps, mainly the step involving optimization, it is necessary to install the following packages

- openopt. This can be done from the command line using the command "pip install openopt", or one can download it directly from https://pypi.python.org/pypi/openopt, and unzip the tar.gz file and run "python setup.py install" from inside the unzipped folder.

- funcdesigner. Again this can be done from the command line with the phrase "pip install funcdesigner". One could also download it directly from https://pypi.python.org/pypi/FuncDesigner, unzip the tar.gz folder and run "python setup.py install" from inside the unzipped folder. 

- glpk. This can be done from homebrew, the command line package installer. HOMEBREW MUST BE UPDATED BEFORE INSTALLING glpk. To install glpk using brew, run the command "brew install glpk" or "brew install homebrew/science/glpk". It is also possible to download it from http://www.gnu.org/software/glpk/glpk.html and run "python setup.py install" from inside the unzipped folder. Please make sure the version of the package installed is 4.60.

- cvxopt. The package should be downloaded from http://cvxopt.org/install/. Unzip the folder and navigate inside of the unzipped folder. Three environment variables must be set to tell python where the unzipped folder is, where the glpk folder is, and to use it when using the package cvxopt. They must be set inside the unzipped cvxopt folder.

	- export CVXOPT_BUILD_GLPK=1
	- export CVXOPT_GLPK_LIB_DIR="path/to/glpk/4.60/lib" 
	   	in our case, it looked something like this:
	   		export CVXOPT_GLPK_LIB_DIR="/usr/local/Cellar/glpk/4.60/lib"
	- export CVXOPT_GLPK_INC_DIR="path/to/glpk/4.60/include"
		in our case, the command looked like this:
			export CVXOPT_GLPK_INC_DIR="/usr/local/Cellar/glpk/4.60/include"

- the sklearn package should also be installed as we use that package in projecting the scores.

All of these packages are necessary to run the optimizer, which optimizes the lineup. To run our code without the optimizer, without the optimized lineup, one can simply comment out step 3 in updater.py.

After all the packages are installed, running "python updater.py" will run all of our code.

Because we were unable to get our website, https://lineup-recommender.herokuapp.com/, to update every day because the optimizer packages refused to work on heroku, the optimizing must be done locally. Then to see our lineup, run "python app.py", which uses flask to render the front end, and the address, localhost:5000, will display the webpage with the lineup locally.

- if one does not have the flask package installed, it is possible to install it using the command "pip install flask" or downloading it from https://pypi.python.org/pypi/Flask and unzipping it and running python setup.py install from inside the unzipped folder. 

Sometimes it may show the player's team as an unknown team, UNK, because sometimes NumberFire does not post positions, teams, etc. until late into the day.

We also use anaconda in setting up packages to use in our code. If one wants to use conda, it is downloadable from https://docs.continuum.io/anaconda/install. To create a conda environment run the command "conda create --name <env> --file <this file>", where <env> is the name of the environment and <this file> is conda-requirements.txt. Then to activate the environment, run "source activate <env>". All the packages used are in conda-requirements.txt. If one does not have all the packages listed there, it is recommended to use anaconda to set up the environment along with the packages mentioned above to run our code.

lineuprecommender's People

Contributors

chaitualuru avatar jiajie-chen avatar steffanigomez323 avatar

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.