MCSL 228
MCSL 228
ARTIFICIAL
Indira Gandhi National Open University INTELLIGENCE
School of Computer & Information Sciences
AND
MACHINE LEARNING
LAB
SOCIS FACULTY
Prof. P. Venkata Suresh, Director, SOCIS, IGNOU
Prof. V.V. Subrahmanyam, SOCIS, IGNOU
Dr. Akshay Kumar, Associate Professor, SOCIS, IGNOU
Dr. Naveen Kumar, Associate Professor, SOCIS, IGNOU (on EOL)
Dr. M.P. Mishra, Associate Professor, SOCIS, IGNOU
Dr. Sudhansh Sharma, Assistant Professor, SOCIS, IGNOU
Dr. Manish Kumar, Assistant Professor, SOCIS, IGNOU
PREPARATION TEAM
Dr.Sudhansh Sharma, Asst.Professor Prof Ela Kumar (Content Editor)
SOCIS, IGNOU (Unit Writer) Department of Computers & Engg. IGDTUW,
Delhi
Print Production
Sh. Tilak Raj, Assistant Registrar (Publication), MPDD
, 2022
Indira Gandhi National Open University, 2022
ISBN-
All rights reserved. No part of this work may be reproduced in any form, by mimeograph or any
other means, without permission in writing from the Indira Gandhi National Open University.
Further information on the Indira Gandhi National Open University courses may be obtained from
the University’s office at Maidan Garhi, New Delhi-110068.
Printed and published on behalf of the Indira Gandhi National Open University, New Delhi by
MPDD, IGNOU.
COURSE INTRODUCTION
This course introduces you to practically work with the two most powerful
concepts i.e. Artificial Intelligence (AI) and Machine Learning (ML). After
completing this course you will be able to perform programming for
various techniques of AI and ML, you learned in MCS-224(Artificial
intelligence & Machine Learning) course of this programme.
In order to have better understanding you are advised to firstly get the
conceptual clarity of the various algorithms presented in the MCS-
224(Artificial intelligence & Machine Learning) course of this programme,
and then implement your understanding in Python programming, to solve
the problems given in the various sessions of this course.
BLOCK INTRODUCTION
This is the lab course, wherein you will have the hands on experience for
programming various algorithms of Artificial Intelligence (AI) and
Machine Learning (ML) in Python. You have studied the concepts of both
Artificial Intelligence (AI) and Machine Learning (ML) in the course
(MCS-224 i.e. Artificial Intelligence and Machine Learning).
This block consists of Lab sessions on AI and Machine learning and they
are organized as follows:
Happy Programming!!
AI AND MACHINE LEARNING LAB
Structure Page
No.
2.0 Introduction 18
2.1 Objectives 18
2.2 General Guidelines 18
2.3 Python Libraries for AI and Machine Learning 19
2.4 Working with Python 21
2.5 Running Python Programs 24
2.6 List of Lab Assignments – Session wise 25
2.0 INTRODUCTION
This is the lab course, wherein you will have the hands on experience towards various
Artificial intelligence & Machine Learning algorithms,You have studied in MCS-
224(Artificial intelligence & Machine Learning) course of this programme.
This course explores the implementation of various Artificial intelligence & Machine
Learning algorithms, using Python programming under Google Colabs or ANACONDA
or any other Python programming environment. A list of programming problems is also
provided at the end of each session. Please go through the general guidelines and the
program documentation guidelines carefully.
The pre-requisites of the course includes the understanding of Python programming, you
may refer to the concepts of Python programming given in the course MCS-
201(Programming in C & Python) and also try to attempt the lab exercises given in the
section-2 of MCSL-205(C and Python Lab.).
In order to have better understanding you are advised to firstly get the conceptual clarity of
the various algorithms presented in the MCS-224(Artificial intelligence & Machine
Learning) course of this programme, and then implement your understanding in Python
programming, to solve the problems given in the various sessions of this course.
2.1 OBJECTIVES
After completing this lab course you will be able to:
You may seek assistance in doing the lab exercises from the concerned
lab instructor. Since the assignments have credits, the lab instructor is
obviously not expected to tell you how to solve these, but you may ask
questions concerning the algorithmic implementation of the concepts
of AI and ML in Python programming language or any technical
problem.
For each program you should add comments above each function in
the code, including the main function. This should also include a
description of the function written, the purpose of the function,
meaning of the argument used in the function and the meaning of the
return value (if any).
The comment block above the main function should describe the
purpose of the program. Proper comments are to be provide where and
when necessary in the programming.
The list of the programs (list of programs given at the end, session-
wise) is available to you in this lab manual. For each session, you must
come prepare with the algorithms and the programs written in the
Observation Book. You should utilize the lab hours for executing the
programs, testing for various desired outputs and enhancements of the
programs.
As soon as you have finished a lab exercise, contact one of the lab
instructor / in-charge in order to get the exercise evaluated and also get
the signature from him/her on the Observation book.
The total no. of lab sessions (3 hours each) are 20 and the list of
assignments is provided session-wise. It is important to observe the
deadline given for each assignment.
2) A package must hold the file __init__.py. This does not apply to
modules.
We will learn more about them, as we proceed in this course, don’t worry.
To start with we will discuss about various Frameworks and Libraries first,
you will be learning about their usage and also the usage of methods and
packages, later.
In this course you are given exposure to implement the various algorithms
of Artificial intelligence & Machine Learning (You have studied in MCS-
224) by using various libraries of Python as programming language.
b) Now Run this exe file and install the Python, just click next and go
ahead, till the setup installation is finished
e) Now, just run the setup, and click next-next, till the installation is
completed.
3) Many a times the learners may not be equipped with the systems
having latest hardware configuarations, as desired for the
installation of Python, or their might be compatibility issues with
operating syatem or may be due to any reason you are not able to
install and start your work with Python. Under such circumstances
the solution is Google Colab Notebook
(https://colab.research.google.com /notebooks/ welcome.ipynb), use
this and just login with your gmail account and start your work on
Jupyter Notebook, as simple as that.
2.5 RUNNING PYTHON PROGRAMS
Just click file option and select new workbook, and new Jupyter notebook
will open in Google Colab, now you may start your work.
To begin with just copy paste the code given below, in Google Colab :
Note :
You may refer to the python codes given in Unit no. 16 of MCS-224
You may refer to various links given at section 2.7
2.6 SESSION WISE-LIST OF LAB
ASSIGNMENTS
Now, let us try solving a different kind of a AI and Machine Learning
problems using Python.
LAB SESSIONS ON AI
Note : In each of the problems given in the respective sessions, you are
required to write the algorithm for the given problem, and map the steps of
your algorithm with your python code, by using suitable comments.
Session-1
a) Write a Python Program to Solve N-Queen Problem without
using Recursion.
b) Write a Python Program to implement the Backtracking approach to
solve N Queen’s problem
Session - 2
a) Write a Python Program to implement Min-Max Algorithm
Session – 3
a) Write a Python Program to implement Alpha-Beta Pruning
Algorithm
Session - 4
a) Write a Python Program to implement Breadth First Search
Session – 5
a) Write a Python Program to implement Depth First Search
Session – 6
a) Write a Python Program to implement Iterative Deepening Depth
First search (IDDFS)
Session - 7
a) Write a Python Program to implement Best First Search
Session - 8
a) Write a Python Program to implement A* Algorithm
Session - 9
a) Write a Python Program to implement AO* Algorithm
Session -10
a) Write a Python Program to implement for IDA* (Iterative
Deepening A*) algorithm
LAB SESSIONS ON MACHINE LEARNING
Note : In each of the problems given in the respective sessions, you are
required to write the algorithm for the given problem, and map the steps of
your algorithm with your python code, by using suitable comments.
Also you are required to analyze the results obtained after the
implementation of your code on respective dataset, and submit your
analysis as a summary to each problem given in respective sessions.
Session-11
a) Write a Python Program to implement K-Nearest Neighbor
Algorithm for data classification , choose dataset of your own
choice.
Session – 12
a) Write a Python Program to implement Decision Trees for data
classification , choose data set of your own choice
Session – 13
a) Write a Python Program to implement Support Vector Machines for
data classification , choose dataset of your own choice
Session – 14
a) Write a Python Program to implement Linear regression on a
dataset of your own choice
Session – 15
a) Write a Python Program to implement Support Vector Regression
on a dataset of your own choice
Session – 16
a) Write a Python Program to implement Artificial Neural Network for
data classification , choose dataset of your own choice
Session – 18
a) Write a Python Program to implement Apriori Algorithm on a
dataset of your own choice
Session – 19
a) Write a Python Program to implement K-Means Algorithm on a
dataset of your own choice
Session -20
a) Write a Python Program to implement DBSCAN Algorithm on a
dataset of your own choice
2.7 REFERENCES
https://www.analyticsvidhya.com
https://www.geeksforgeeks.org
https://www.datacamp.com
https://towardsdatascience.com
https://medium.com
https://machinelearningmastery.com