Artificial Intelligence Development Environment Set-up Guide for Windows 64 bit


Accounting : Financial Close

Artificial Intelligence Development Environment Set-up Guide for Windows 64 bit

Choose Your Hands-on Learning Topic

Disclaimer

All software, application, utilities, information, materials and hardware used or referenced in this guide belong to their respective vendor. We developed this guide based on our development infrastructure and this guide may or may not work on others systems and technical infrastructure. We are not liable for any direct or indirect problems Caused to the users using this guide. This development guide has been created to set up an AI development infrastructure for learning purpose only.   
Executive Summary

The purpose of this document is to provide adequate information to the users to setup python infrastructure for artificial intelligence application development. In this document, We are also providing steps to verify python installation and set of sample programs to develop, test and deploy.
What is Python?

Python is a programming language that lets you work more quickly and integrate your systems more effectively. It is a general-purpose interpreted, interactive, object oriented and high-level programming language.
Python: Version 3.7.0

The Python download requires about 30 Mb of disk space; keep it on your machine, in case you need to re-install Python. When installed, Python requires about an additional 90 Mb of disk space.
Downloading Python Runtime

Visit https://www.python.org/downloads/

The Following Page will appear in your Browser


 Downloading Python Runtime


Click the Download Python 3.7.0 button.

The file named python-3.7.0.exe should start downloading into your standard download folder. This file is about 30 Mb so it might take a while to download fully if you are on a slow internet connection.


 Downloading Python Runtime


The file should appear as python-3.7.0.exe

  • Move this file to a more permanent location, so that you can install Python (and reinstall it easily later, if necessary).
  • Feel free to explore this webpage further; if you want to just continue the installation, you can terminate the tab browsing this webpage.
  • Start Installing as per the below instructions
Installing Python

Double-click the icon labeling the file python-3.7.0.exe. An Open File - Security Warning pop-up window will appear as shown


Installing Python


Click Run. A Python 3.7.0 (32-bit) Setup pop-up window will appear.


Installing Python


Ensure that the Install launcher for all users (recommended) and the Add Python 3.7 to PATH checkboxes at the bottom are checked. Click Install Now message, as shown to install Python in your System.


Installing Python


Python 3.7.0 (32-bit) Setup pop-up window will appear with a Setup Progress message and a progress bar as shown.


Installing Python


During installation, it will show the various components it is installing and move the progress bar towards completion. Soon, a new Python 3.7.0 (32-bit) Setup pop-up window will appear with a Setup was Successfully message.


Installing Python


Click the Close button. Python should now be installed.
Verifying Python Installation

To try to verify installation,

  • Navigate to the directory C:\Users\user\AppData\Local\Programs\Python\Python37-32 (or to whatever directory Python was installed).
  • Double-click the icon/file python.exe as shown below.

Verifying Python Installation


The following pop-up window will appear.


Verifying Python Installation


You should keep the file python-3.7.0.exe somewhere on your computer in case you need to reinstall Python (not likely necessary).
Simple Python Programs

You should now have a Python menu choice as shown. Start the program by choosing IDLE (Python GUI).


Simple Python Programs


This starts the python shell. You can type in simple commands to see how they work


Simple Python Programs
PROGRAM - 1

To Print a Welcome Message "Hello Welcome, I am Python'


Step 1: Open Python IDLE

Python IDLE is launched through the command prompt. Type cmd & Search to Open Command prompt terminal


Python Programs 1


The Python Shell Opens up as Shown


Python Programs 1


Step 2: Open a New File in Python IDLE

To Open a New File Follow the Below Screenshot


Python Programs 1


Step 3: Typing a New Program

Type the Program as Shown


Python Programs 1


Save your file by going to File -> Save


Python Programs 1


Give the file a name and put the .py suffix on it.


Python Programs 1


Step 4: Run the Program

To Run the Program, follow the Below Steps


Python Programs 1


Step 5: Check the Result/Outcome of the Program

After the program is run, The Output of the Program Appears in the Python Shell as shown.


Python Programs 1
PROGRAM - 2

Add Two Numbers

Step 1: Open Python IDLE

Python IDLE is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Python Programs 2


The Python Shell Opens up as Shown


Python Programs 2


Step 2: Open a New File in Python IDLE

To Open a New File Follow the Below Screenshot



Python Programs 2


Step 3: Typing a New Program

Type the Program as Shown


Python Programs 2


Save your file by going to File -> Save


Python Programs 2


Give the file a name and put the .py suffix on it.


Python Programs 2


Step 4: Run the Program

To Run the Program, follow the Below Steps


Python Programs 2


Step 5: Check the Result/Outcome of the Program

After the program is run, The Output of the Program Appears in the Python Shell as shown.


Python Programs 2
PROGRAM - 3

Find the largest among three numbers


Step 1: Open Python IDLE

Python IDLE is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Python Programs 3


The Python Shell Opens up as Shown


Python Programs 3


Step 2: Open a New File in Python IDLE

To Open a New File Follow the Below Screenshot


Python Programs 3


Step 3: Typing a New Program

Type the Program as Shown


Python Programs 3


Save your file by going to File -> Save


Python Programs 3


Give the file a name and put the .py suffix on it.


Python Programs 3


Step 4: Run the Program

Python Programs 3


Step 5: Check the Result/Outcome of the Program

After the program is run, The Output of the Program Appears in the Python Shell as shown


Python Programs 3
PROGRAM - 4

To Check Whether the Input Number is Odd or Even


Step 1: Open Python IDLE

Python IDLE is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Python Programs 4


The Python Shell Opens up as Shown


Python Programs 4


Step 2: Open a New File in Python IDLE

To Open a New File Follow the Below Screenshot


Python Programs 4


Step 3: Typing a New Program

Type the Program as Shown


Python Programs 4


Save your file by going to File -> Save


Python Programs 4


Give the file a name and put the .py suffix on it.


Python Programs 4


Step 4: Run the Program

Python Programs 4


Step 5: Check the Result/Outcome of the Program

After the program is run, The Output of the Program Appears in the Python Shell as shown


Python Programs 4
PROGRAM - 5

To Check Whether an Integer is Prime or Not


Step 1: Open Python IDLE

Python IDLE is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Python Programs 5


The Python Shell Opens up as Shown


Python Programs 5


Step 2: Open a New File in Python IDLE

To Open a New File Follow the Below Screenshot


Python Programs 5


Step 3: Typing a New Program

Type the Program as Shown


Python Programs 5


Save your file by going to File -> Save


Python Programs 5


Give the file a name and put the .py suffix on it.


Python Programs 5


Step 4: Run the Program

Python Programs 5


Step 5: Check the Result/Outcome of the Program

After the program is run, The Output of the Program Appears in the Python Shell as shown


Python Programs 5
Anaconda 5.2

Installation & Set-up

Windows 64 bit


What is Anaconda?

Anaconda is a free and Open Source Distribution of the Python and R programming languages for Data Science and Machine Learning related applications (large-scale data processing, predictive analytics, scientific computing), that aims to simplify package management and deployment. Anaconda distribution comes with more than 1,000 data packages as well as the Conda package and virtual environment manager called Anaconda Navigator

Anaconda Navigator

Anaconda Navigator is a desktopgraphical user interface (GUI) included in Anaconda distribution that allows you to launch applications and manage conda packages, environments and channels without using command-line commands. Navigator can search for packages on Anaconda Cloud or in a local Anaconda Repository, install them in an environment, run the packages and update them. It is available for Windows, macOS and Linux.
Downloading Anaconda

Visit  https://www.anaconda.com/download/

The Following Page Appears


Downloading Anaconda


Scroll down & look for anaconda 5.2 for Windows Installer as shown Below. Select 64-Bit/32-Bit as per your systems Operating System.


Downloading Anaconda
Installing Anaconda

Go to Downloads folder where its downloaded & double click to Run it...


Installing Anaconda


Installing Anaconda


Click Next


Installing Anaconda


Click I Agree


Installing Anaconda


Click Next


Installing Anaconda


Select a Destination Installation Path or leave it as default.


Installing Anaconda


Select "Add Anaconda to My Path environment variable".


Installing Anaconda


Installing Anaconda
Verifying Anaconda

After you finished installing, open Command Prompt. Go to Start & Type cmd in the Search programs & files Box as shown.


Verifying Anaconda


Type Jupiter notebook & press Enter as shown


Verifying Anaconda


The Below Page opens


Verifying Anaconda


To Test whether its Working or not Open a New Notebook as shown. Select Python (conda root) or whichever python notebook that is available.


Verifying Anaconda


Type print (‘Hello Welcome, I am Python’). Press Shift + Enter Key.


Verifying Anaconda
Simple Python Programs using Anaconda

PROGRAM - 1

Program to generate a random number between 0 and 9


Step 1: Open Jupyter Notebook:

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Simple Python Programs using Anaconda Program 1


Now Type Jupiter notebook & press Enter as shown


Simple Python Programs using Anaconda Program 1


The Below Page opens


Simple Python Programs using Anaconda Program 1


Step 2: Open a New File or New Program in Jupyter Notebook:

To Open a New File, follow the Below Instructions

Go to New >>>Python [conda root]


Simple Python Programs using Anaconda Program 1


Give a name to the File as shown below.


Simple Python Programs using Anaconda Program 1


Provide a Heading to the program as shown below.


Simple Python Programs using Anaconda Program 1


Step 3: Typing a New Program:

Write the Program & Execute (Shift + Enter) as shown Below.

To generate a random number in Python a function called randint() is used.


Simple Python Programs using Anaconda Program 1


Step 4: Run the Program:

To Run the Program, follow the Below Steps


Simple Python Programs using Anaconda Program 1


Step 5: Check the Result/Outcome of the Program:

Just after the program is run, The Output of the Program Appears Just Below the Cell as shown below



Simple Python Programs using Anaconda Program 1
PROGRAM - 2

Program to Swap Two Variables


Step 1: Open Jupyter Notebook

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Program to Swap Two Variables


Now Type Jupiter notebook & press Enter as shown


Program to Swap Two Variables



The Below Page opens


Program to Swap Two Variables


Step 2: Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


Program to Swap Two Variables


Give a name to the File as shown below.


Program to Swap Two Variables


Provide a Heading to the program as shown below.


Program to Swap Two Variables


Step 3: Typing a New Program

Write the Program & Execute (Shift + Enter) as shown Below.


Program to Swap Two Variables


Step 4: Run the Program

To Run the Program, follow the Below Steps


Program to Swap Two Variables


Step 5: Check the Result/Outcome of the Program

Just after the program is run, the Output of the Program Appears Just Below the Cell as shown below


Program to Swap Two Variables
PROGRAM - 3

Program to Convert Kilometers to Miles


Step 1: Open Jupyter Notebook

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Program to Convert Kilometers to Miles


Now Type Jupiter notebook & press Enter as shown


Program to Convert Kilometers to Miles


The Below Page opens


Program to Convert Kilometers to Miles


Step 2: Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


Program to Convert Kilometers to Miles


Give a name to the File as shown below.


Program to Convert Kilometers to Miles


Provide a Heading to the program as shown below.


Program to Convert Kilometers to Miles


Step 3: Typing a New Program

Write the Program & Execute (Shift + Enter) as shown Below.


Program to Convert Kilometers to Miles


Step 4: Run the Program

To Run the Program, follow the Below Steps


Program to Convert Kilometers to Miles


Step 5: Check the Result/Outcome of the Program

Just after the program is run, the Output of the Program Appears Just Below the Cell as shown below


Program to Convert Kilometers to Miles
Scikit-learn 0.19.0

Working with Machine Learning Libraries


What is Scikit-learn?

Scikit-learn is a Python open source library designed to tackle Machine Learning problems from beginning to end. It is used and well praised by big companies like Evernote and Spotify. Moreover, it has tools for all steps of a typical ML workflow. You can use it to load data, separate datasets into train and test sets, perform dimensionality reduction and feature selection, train several well-known and well implemented algorithms and fine tune your hyper parameters using model selection. The final result is a robust, efficient and well coded solution for a predictive model. The best part is you will do all of this in a fast development cycle, which Python programmers/developers are used to.

Scikit-learn comes as an inbuilt library with Anaconda Installation. We don’t have to install it Separately. It also provides us with few inbuilt Datasets like Boston House Price Dataset, Iris Dataset, and Wine Dataset.
PROGRAM - 1

Program to Load Boston House Prices Dataset (Inbuilt)


Step 1: Open Jupyter Notebook

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Program to Load Boston House Prices Dataset (Inbuilt)


Now Type Jupiter notebook & press Enter as shown


Program to Load Boston House Prices Dataset (Inbuilt)


The Below Page opens


Program to Load Boston House Prices Dataset (Inbuilt)


Step 2: Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


Program to Load Boston House Prices Dataset (Inbuilt)


Give a name to the File as shown below.


Program to Load Boston House Prices Dataset (Inbuilt)


Provide a Heading to the program as shown below.


Program to Load Boston House Prices Dataset (Inbuilt)


Step 3: Typing a New Program

The Machine Learning Library scikit-learn (sklearn) has some inbuilt dataset for Machine Learning Techniques. Let’s Fetch the inbuilt Dataset Boston house Prices.

The command “import” is issued for fetching the dataset. Then the fetched Data is stored in a variable Called Boston_House_Prices. The command Boston_house_Prices.data is issued to print the fetched dataset.

Write the Program & Execute (Shift + Enter) as shown Below.


Program to Load Boston House Prices Dataset (Inbuilt)


Step 4: Run the Program

To Run the Program, follow the Below Steps


Program to Load Boston House Prices Dataset (Inbuilt)


Step 5: Check the Result/Outcome of the Program

Just after the program is run, the Output of the Program Appears Just Below the Cell as shown below


Program to Load Boston House Prices Dataset (Inbuilt)
PROGRAM - 2

Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Step 1: Open Jupyter Notebook

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Now Type Jupiter notebook & press Enter as shown


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


The Below Page opens


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Step 2: Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Give a name to the File as shown below.


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Provide a Heading to the program as shown below.


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Step 3: Typing a New Program

Program to Slice & Dice Data (Get Specified Rows & Columns of Data)



The Machine Learning Library scikit-learn (sklearn) has some inbuilt dataset for Machine Learning Techniques. Let’s Fetch the inbuilt Dataset Boston house Prices.

The Command “import” issued for fetching the dataset. Then the fetched Data is stored in a variable Called Boston_House_Prices.  The Command Boston_House_Prices.data[:10] is Issued to Fetch First 10 Rows of the Data set.

Write the Program & Execute (Shift + Enter) as shown Below.

Step 4: Run the Program

To Run the Program, follow the Below Steps


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)


Step 5: Check the Result/Outcome of the Program

Just after the program is run, the Output of the Program Appears Just Below the Cell as shown below


Program to Slice & Dice Data (Get Specified Rows & Columns of Data)
TensorFlow

Installing & Working with Deep Learning Libraries


What is TensorFlow?

TensorFlow is a popular open source library & a framework of Deep Learning. The Deep Learning is part of Machine Learning, Deep learning is also a large part of machine learning methods based on learning data presentations “as opposed to task-specific algorithms.” It’s a framework to perform computation very efficiently, and it can tap into the GPU (Graphics Processor Unit) in order to speed it up even further. TensorFlow can be controlled by a simple Python API.

TensorFlow is cross-platform. It runs on nearly everything: GPUs and CPUs—including mobile and embedded platforms—and even tensor processing units (TPUs), which are specialized hardware to do tensor math on.

TensorFlow does not comes inbuilt with Anaconda Package Installation. It has to be installed by the user to Perform Deep Learning Applications. TensorFlow cannot be installed on 32-Bit Operating System Windows Machines it can only be installed on 64-Bit Windows, Linux, Mac OS machines.
Installation:

To Install TensorFlow, Open Command Prompt & type:

Conda install –c conda-forge TensorFlow


Install TensorFlow
Verification

To Verify Whether Tensorflow is Installed Correctly or not , follow the Below Shown Steps.

Open Jupyter Notebook

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


TensorFlow Verification


Now Type Jupiter notebook & press Enter as shown


TensorFlow Verification


The Below Page opens


TensorFlow Verification


Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


TensorFlow Verification


In the New File type, the Below Command

Import tensorflow as tf.

Shift + Enter to Execute. If the Command Executes without any Error it means that Tensorflow is Installed without any issues as shown.



TensorFlow Verification
PROGRAM - 1

Program to add two Numbers using TensorFlow


Step 1: Open Jupyter Notebook

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Program to add two Numbers using TensorFlow


Now Type Jupiter notebook & press Enter as shown


Program to add two Numbers using TensorFlow


The Below Page opens


Program to add two Numbers using TensorFlow


Step 2: Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


Program to add two Numbers using TensorFlow


Give a name to the File as shown below.


Program to add two Numbers using TensorFlow


Provide a Heading to the program as shown below.


Program to add two Numbers using TensorFlow


Step 3: Typing a New Program

Write the Program & Execute (Shift + Enter) as shown Below



Program to add two Numbers using TensorFlow


The Deep Learning library TensorFlow is used here for adding adding two arrays. Tensorflow is imported by the import command. Then a Constant is used for storing the Arrays into a Variable. Constants are used when you want a fixed Value. Next, you can use add () to add your two variables. Store the result in the result variable. Lastly, print out the result with the help of the print () function


Note:Tensors are all about arrays. So, make sure that you pass in an array as data.


Step 4: Run the Program

To Run the Program, follow the Below Steps


Program to add two Numbers using TensorFlow


Step 5: Check the Result/Outcome of the Program

Just after the program is run, the Output of the Program Appears Just Below the Cell as shown below


Program to add two Numbers using TensorFlow
PROGRAM - 2

Program to Multiply two Matrices using TensorFlow


Step 1: Open Jupyter Notebook:

Jupiter notebook is launched through the command prompt. Type cmd & Search to Open Command prompt Terminal.


Program to Multiply two Matrices using TensorFlow


Now Type Jupiter notebook & press Enter as shown


Program to Multiply two Matrices using TensorFlow


The Below Page opens


Program to Multiply two Matrices using TensorFlow


Step 2: Open a New File or New Program in Jupyter Notebook

To Open a New File, follow the Below Instructions

Go to New >>> Python [conda root]


Program to Multiply two Matrices using TensorFlow


Give a name to the File as shown below.


Program to Multiply two Matrices using TensorFlow


Provide a Heading to the program as shown below.


Program to Multiply two Matrices using TensorFlow


Step 3: Typing a New Program

Write the Program & Execute (Shift + Enter) as shown Below


Program to Multiply two Matrices using TensorFlow


The DeepLearning Library Tensflow is used here for adding two Arrays. Tensorflow is imported by the import command. Then a Constant is used for storing the Arrays into a Variable. Constants are used when you want a fixed Value. Next, you can use add () to add your two variables. Store the result in the result variable. Lastly, print out the result with the help of the print () function

Note:Tensors are all about arrays. So, make sure that you pass in an array as data.

Step 4: Run the Program

To Run the Program, follow the Below Steps.


Program to Multiply two Matrices using TensorFlow


Step 5: Check the Result/Outcome of the Program

Just after the program is run, the Output of the Program Appears Just Below the Cell as shown below


Program to Multiply two Matrices using TensorFlow
Customers’ Vocal Endorsements
We have been delivering impactable products and services on artificial intelligence, data engineering, finance, analytics, training and talent development for every business function. We work closely with senior executives as well as technical developers.


Download Request
Contact

Point of Contact

Jothi Periasamy
Chief AI Architect


Address

2100 Geng Road
Suite 210
Palo Alto
CA 94303


Contact e-Mail

lnfo@DeepSphere.AI


Contact Phone

(916)-296-0228


Web

https://www.deepsphere.ai