This post will take you through the basics of machine learning using python with scikit-learn and tensorflow and also show the installation process for each. As discussed in the earlier post, python is the most commonly used language for machine learning applications so the first steps for us would be installing python libraries.
1. Python:
Python packages are split into two versions of it as Python2 and Python3 but for simplicity we will only focus on installing Python3.
For Windows and Mac users installing python is easy due to installer available at https://www.python.org/downloads/
After installing python on windows try running python on command prompt by:
Note: Windows users don't forget to include location for python.exe in PATH environment variable of windows
For Linux/Unix users you need to open terminal and execute the following commands
First add python3 PPA to your OS repository:
Then check for updates and install python3 via command:
For Windows and Mac users installing python is easy due to installer available at https://www.python.org/downloads/
After installing python on windows try running python on command prompt by:
| python --version |
For Linux/Unix users you need to open terminal and execute the following commands
First add python3 PPA to your OS repository:
| sudo add-apt-repository ppa:jonathonf/python-3.6 |
| sudo apt-get update
sudo apt-get install python3.6
|
| sudo update-alternatives --config python3 |
| python3 -V |
2. pip install python:
pip is the most commonly used python package installer used for installing third-party Python packages available on the Python Package Index(PyPI). Generally pip is automatically installed alongside python3 installation but to be sure you should check availability of pip by:
| pip --version |
For users of any platform download the get-pip.py file
(Note: if instead of downloading the file your browser is opening a page, copy the text in a notepad/textedit and save it by the name get-pip.py)
Open command prompt and go to location where get-pip.py is stored and run the command:
| python get-pip.py |
For Linux/Unix users installing pip is done just by the following commands but I would recommend using the first method:
| sudo apt-get install python3-pip python3-dev |
3. TensorFlow:
TensorFlow installation for python can be done easily through pip by using the command
| pip install tensorflow |
| pip install --upgrade <tfbinary> |
After installation you can verify it by doing the following steps
| python |
| #Python import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello)) |
Along with tensorflow package it is better to also have NumPy and Pandas library, but I will let you install them yourself.
Intro to Machine Learning through Python
Comments
Post a Comment