Skip to main content

Machine Learning Quickies


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:
          python --version
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:
          sudo add-apt-repository ppa:jonathonf/python-3.6
 Then check for updates and install python3 via command: 
          sudo apt-get update
sudo apt-get install python3.6
 Select the version of python to run by default by:
          sudo update-alternatives --config python3
 Finally check python version by:
          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
If the output of this command is a version number of pip then pip was successfully installed but if not try the following steps.

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
If the installation fails try running the following command
          pip install --upgrade <tfbinary>
Here the appropriate value of tfbinary to be used can be found here.
After installation you can verify it by doing the following steps
          python
After that in the python shell type the following program
          #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

Popular posts from this blog

Git : Todo and not Todo : Part-2

Hello there! This is the second part to introduction to git. If you have not read the first part then please first go through that first, as proceeding along here without that introductory knowledge will not be really helpful.Here is a link TL;DR All the git commands that we will be talking about, now and later-: git init git clone git add git commit git status git remote git push git pull git fetch git branch git reset So, lately we learnt about Version Control Systems also abbreviated as VCS and got to know about git and how it is completely different from github and other VCS hosting websites. In this part we will be looking on the more practical part of using this wonderful tool and also why we should learn it very first in our development career. Later, I will also help you understand that git is just a small part of the entire development career that you aspire to make and why it should not be considered just more than a medium to share your code with...

Competitive Programming

Competitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications. Contestants are referred to as sport programmers. Competitive Programming mainly focuses on our ability to find efficient solutions to well-defined problems. Usually, a question arises - Why Competitive Programming? Many of the top tech companies like Google, Facebook hire people through a test which includes competitive programming. Also, participation in the ACM International Collegiate Programming Contest (ACM-ICPC) is a great opportunity to be seen by Apple, Facebook, Google, IBM and many other authorities in the IT sphere. These major companies are constantly keeping track of the participants to find talented employees. Having experience in competitive programming shows employers you can work in a team, solve complicated problems, work in stressful situations, manage time and deadl...

A beginners guide to NumPy

The previous post took you through the basics of machine learning using python with scikit-learn and tensorflow, this post will give you a brief introduction to Numpy. NumPy is a python package which stands for "Numeric Python". It enables you to do mathematical computations easily and effectively hence making coding simpler. http://www.numpy.org/ Installing via pip: After having python3 and pip installed, installing packages can be done using the following command on windows cmd. >>> python - m pip install -- user numpy scipy matplotlib ipython jupyter pandas --user   makes pip install packages in your home directory instead, which doesn't require any special privileges. Import Numpy: >>> import numpy as np Now we use np as a reference to numpy in the code. Numpy arrays: Create a numpy array of type np.ndarray: >>> A = np.array([[1,2,3],[4,5,6],[7,8,9]]) Create a numpy array containing ones/...

Git : To do and Not To do: Part- 1

Git is a version control system that helps to maintain versions of your work over time. The above line may seem a bit overwhelming to read at first, as there are words which most of us not really understand as of now. Just read along and I will help you in getting some idea of why git is a resource every developer has to be sound with and why it is a integral part of every developer's everyday life. A version control system :- We all have heard the saying that Rome was not built in a day and believe me, if it is not your college assignments , no great app was ever built in a day or at least without using a VCS( version control system). Every app has multiple sections. Every section require some skills that is used to develop it. A skill may come under a set of skill that a contributor has.  When we work alone or in a group with other developers, making any single project, it tends to happen that people take up sections that they are good at, as they believe that they can contri...