Trying out examples from Udacity's Machine Learning course.
For the following commands to work, do the Requirements section first if it's your first time running this.
Simply run the following command for each file you wish to run:
python file_name.py
For managing dependencies this project uses a requirements.txt file, the pom file of Python.
- Install pip using the following command:
sudo easy_install pip
- Use the requirements.txt file to install all dependencies by calling the following command from within the root of the project:
pip install -r requirements.txt
This will install, among others, matplotlib
.
For this, there is a directory in you root called ~/.matplotlib
.
Create a file ~/.matplotlib/matplotlibrc
there and add the following code: backend: TkAgg
The reason behind this is explained here.
If you run into any errors, try installing the following:
sudo apt-get install python-setuptools
Machine Learning is an introductory course on this subject. I am simply trying out the examples from Udacity's course.
All logs will be printed to stderr, and thus all the errors will be found there.
Please install the following in order to run the project and the analysis tool against it:
brew install pyenv-virtualenv
Please follow all the steps in the Github project link above.
- The analysis tool will run in a virtual environment https://github.com/pyenv/pyenv Install using the below:
pyenv install 2.7.13
pyenv virtualenv 2.7.13 machine-learning
pyenv activate machine-learning
Run the following command if you wish to remove the virtual environment created:
pyenv uninstall machine-learning
This is an extra step before first installing Pylint.
Change to the root of the project and generate the initial settings file for Pylint using:
pylint --generate-rcfile > .pylintrc
Disable some of the warnings (e.g. missing-docstring, bare-except, fixme, redefined-builtin, too-many-locals) by adding these (missing-docstring,bare-except,fixme,redefined-builtin,too-many-locals) to the end of the line which starts disable= if you wish to turn that off.
- Install Pylint https://www.pylint.org/ :
pip install pylint
- Now, while in the root of the project opened from the last used command line, evaluate the code using:
pylint *.py
You will see something like this:
Your code has been rated at 8.60/10
- For managing dependencies use a requirements.txt file, the pom file of Python.
pip install -r requirements.txt
- See all dependencies using the following command:
pip freeze
Pipe directly all dependencies into the requirements.txt file in a sorted manner using the following command line:
pip freeze | sort > requirements.txt
- When inside the virtual env, you need to install dependencies again, otherwise Pylint will complain it cannot import them. Use the requirements.txt file to install all dependencies by calling the following from within the root of the project:
pip install -r requirements.txt