Professional Documents
Culture Documents
Lab Manual
Department of Computer Science and Engineering
The NorthCap University, Gurugram
ii
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
Session 2022
Published by:
Machine
Learning Lab Manual (CSL 313)
2022
© Copyright Reserved
Copying or facilitating copying of lab work comes under cheating and is considered as use
of unfair means. Students indulging in copying or facilitating copying shall be awarded zero
marks for that particular experiment. Frequent cases of copying may lead to disciplinary
action. Attendance in lab classes is mandatory.
Labs are open up to 7 PM upon request. Students are encouraged to make full use of labs
beyond normal lab hours.
PREFACE
Machine Learning Lab Manual is designed to meet the course and program requirements of
NCU curriculum for B.Tech III year students of CSE branch. The concept of the lab work is
to give brief practical experience for basic lab skills to students. It provides the space and
scope for self-study so that students can come up with new and creative ideas.
The Lab manual is written on the basis of “teach yourself pattern” and expected that
students who come with proper preparation should be able to perform the experiments
without any difficulty. Brief introduction to each experiment with information about self-
study material is provided. The pre-requisite is having a basic working knowledge of
Python. The laboratory exercises will include familiarization with unsupervised ML like
Clustering and Association rule mining, introduction to Reinforcement Learning; Feature
Selection and Dimensionality Reduction. Students would learn the algorithms pertaining to
these and implement the same using a high-level language, i.e. Python. Students are
v
Machine
Learning Lab Manual (CSL 313)
2022
expected to come thoroughly prepared for the lab. General disciplines, safety guidelines
and report writing are also discussed.
The lab manual is a part of curriculum for the The NorthCap University, Gurugram.
Teacher’s copy of the experimental results and answer for the questions are available as
sample guidelines.
We hope that lab manual would be useful to students of CSE, IT, ECE and BSc branches and
author requests the readers to kindly forward their suggestions / constructive criticism for
further improvement of the work book.
Author expresses deep gratitude to Members, Governing Body-NCU for encouragement and
motivation.
Authors
The NorthCap University
Gurugram, India
CONTENTS
Syllabus 6
1 Introduction 9
2 Lab Requirement 10
3 General Instructions 11
4 List of Experiments 13
vi
Machine
Learning Lab Manual (CSL 313)
2022
6 List of Projects 16
7 Rubrics 17
SYLLABUS
1. Department: Department of Computer Science and Engineering
6. Type of Course j
(Check one): Programme Core Programme Elective Open Elective
d
7. Pre-requisite(s), if any: Introduction to AI and ML
8. Frequency of offering (check one): Odd Even Either semester Every semester
9. Brief Syllabus:
Overview to machine learning and pre-processing concepts, Model Selection, Model Selection, XGBoost. Feature
Selection- Filter and Wrapper, Dimensionality Reduction, Principal Component Analysis PCA, Linear Discriminant
Analysis LDA, Kernel PCA, Introduction to Self-Organizing Maps (SOM), Building a Self-Organizing Map. Overview
of clustering in machine learning, Different categories of clustering algorithms, similarity/distance measures, K
Means algorithm, Hierarchical, DBSCan, Fuzzy C-Means , Agglomerative clustering algorithm, Expectation
maximization (EM) for soft clustering. Semi-supervised learning with EM using labeled and unlabled data.,
Evaluation methods, A case study with clustering implementation, Eclat, Recommendation System , User Based
Recommendation System, Item Based Recommendation System, Matrix-Factorization Recommendation System
Total lecture, Tutorial and Practical Hours for this course (Take 15 teaching weeks per semester): 90 hours
The class size is maximum 30 learners
Practice
Lectures: 30 hours
Tutorials : 0 hours Lab Work: 60 hours
10. Course Outcomes (COs)
On successful completion of this course students will be able to:
vii
Machine
Learning Lab Manual (CSL 313)
2022
Understand the difference between supervised and unsupervised approaches and design the model
CO 1
with no training data.
CO 2 Implement the methods to find frequent Patterns and associations in the patterns.
Implement the real-world problems with model selection and optimized feature selection for further
CO 5
processing of the data.
Basic concepts of frequent pattern mining, Frequent Itemset mining methods, Apriori algorithm, Eclat algorithm,
Vertical Data format method, pattern evaluation methods, association analysis to correlation analysis.
Content Summary: Introduction to Recommendation System, User Based Recommendation System, Item Based
Recommendation System, Matrix-Factorization Recommendation System.
Content Summary:
Introduction to dimensionality reduction, Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA),
Kernel PCA.
Content Summary: Pre-processing concepts, Model Selection, Model Selection, XGBoost. Feature Selection-
Filter and Wrapper, Introduction to Self-Organizing Maps (SOM), Building a Self-Organizing Map
viii
Machine
Learning Lab Manual (CSL 313)
2022
12. Brief Description of Self-learning components by students (through books/resource material etc.):
Data preprocessing techniques
1. Machine Learning using Python Paperback – 1 January 2019, by U Dinesh Kumar, Manaranjan Pradhan, Wiley,
https://www.amazon.in/Machine-Learning-Python-Manaranjan-Pradhan/dp/8126579900.
2. Matthew Kirk, “Thoughtful Machine Learning: A Test-Driven Approach” , First Edition, O'Reilly Publications, 2014.
Reference Websites: (nptel, swayam, coursera, edx, udemy, lms, official documentation weblink)
https://www.coursera.org/learn/practical-rl#syllabus
https://nptel.ac.in/courses/106/106/106106139/
https://www.coursera.org/learn/machine-learning
1. INTRODUCTION
OBJECTIVE:
The purpose of conducting experiments can be stated as follows:
To familiarize the students with the basic concepts of Machine Learning like
supervised, unsupervised and reinforcement learning.
The lab sessions will be based on exploring the concepts discussed in class.
Learning and understanding Clustering.
ix
Machine
Learning Lab Manual (CSL 313)
2022
2. LAB REQUIREMENTS
Machine
Learning Lab Manual (CSL 313)
2022
3. GENERAL INSTRUCTIONS
Students must turn up in time and contact concerned faculty for the experiment
they are supposed to perform.
Students will not be allowed to enter late in the lab.
Students will not leave the class till the period is over.
Students should come prepared for their experiment.
Experimental results should be entered in the lab report format and
certified/signed by concerned faculty/ lab Instructor.
Students must get the connection of the hardware setup verified before
switching on the power supply.
xi
Machine
Learning Lab Manual (CSL 313)
2022
3.2 Attendance
Students should come to the lab thoroughly prepared on the experiments they
are assigned to perform on that day. Brief introduction to each experiment
with information about self study reference is provided on LMS.
Students must bring the lab report during each practical class with written
records of the last experiments performed complete in all respect.
Each student is required to write a complete report of the experiment he has
performed and bring to lab class for evaluation in the next working lab.
Sufficient space in work book is provided for independent writing of theory,
observation, calculation and conclusion.
Students should follow the Zero tolerance policy for copying / plagiarism. Zero
marks will be awarded if found copied. If caught further, it will lead to
disciplinary action.
Refer Annexure 1 for Lab Report Format
xii
Machine
Learning Lab Manual (CSL 313)
2022
4. LIST OF EXPERIMENTS
Sr. Title of the Experiment Software Unit CO
No. used Covered Covered
1. Perform K-means clustering Algorithm. Write the python Python 1 CO1
code to find Intercluster distance and IntraCluster (Jupyter)
Distance.
2. Perform K means Clustering on given dataset. Identify Python 1 CO1
number of clusters using elbow method. (Jupyter)
3. Perform hierarchical clustering on given dataset. Identify Python 1 CO1
number of clusters using dendograms. (Jupyter)
4. Compare K-means and Hierarchical clustering for any Python 1 CO1
xiii
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
5.1 Project – supervised and unsupervised learning based model on market basket
analysis
5.2 Competition on Kaggle
6. LIST OF PROJECTS
1. Titanic Challenge: The sinking of the Titanic is one of the most infamous
shipwrecks in history. On April 15, 1912, during her maiden voyage, the widely
considered “unsinkable” RMS Titanic sank after colliding with an iceberg.
Unfortunately, there weren’t enough lifeboats for everyone onboard, resulting in
the death of 1502 out of 2224 passengers and crew. While there was some
element of luck involved in surviving, it seems some groups of people were more
likely to survive than others. In this project, the students need to build a predictive
xv
Machine
Learning Lab Manual (CSL 313)
2022
model that answers the question: “what sorts of people were more likely to
survive?” using passenger data (ie name, age, gender, socio-economic class, etc).
2. House Price Prediction Using Advanced Regression Techniques: Ask a home buyer
to describe their dream house, and they probably won't begin with the height of
the basement ceiling or the proximity to an east-west railroad. But Kaggle’s
advanced house price prediction dataset proves that much more influences price
negotiations than the number of bedrooms or a white-picket fence. With 79
explanatory variables describing (almost) every aspect of residential homes in
Ames, Iowa, this dataset can be used to predict the final price of each home.
3. Mechanism of Action (MoA) Prediction: Mechanism of action means the
biochemical interactions through which a drug generates its pharmacological
effect. If we know a disease affects some particular receptor or downstream set of
cell activity, we can develop drugs faster if we can predict how cells and genes
affect various receptor sites. Using a dataset that combines gene expression and
cell viability data in addition to the MoA annotations of more than 5,000 drugs. In
this, each drug was tested under two dose (cp_dose) and three times (cp_time). So,
six samples basically correspond to one drug. We need to train a model that
classifies drugs based on their biological activity. This problem is a multi-label
classification, which means we have multiple targets (not multiple classes). In this
project, perform explanatory data analysis and then train a model using deep
neural networks with Keras.
7. RUBRICS
Marks Distribution
Continuous Evaluation (15 Marks) Project Evaluations (80 Marks)
Each experiment shall be evaluated for 10 Both the projects shall be evaluated for
marks and at the end of the semester 30 marks each and at the end of the
proportional marks shall be awarded out semester viva will be conducted related
of total 15. to the projects as well as concepts
Following is the breakup of 10 marks for learned in labs and this component
each carries 20 marks.
xvi
Machine
Learning Lab Manual (CSL 313)
2022
Annexure 1
Machine Learning
(CSL 313)
Machine
Learning Lab Manual (CSL 313)
2022
Semester: 6th
Group: DS-E-9
Machine
Learning Lab Manual (CSL 313)
2022
INDEX
S.No Experiment Page Date of Date of Marks CO Sign
No. Experiment Submission Covered
1 Perform K-means
clustering Algorithm. Write
the python code to find
Intercluster distance and
IntraCluster Distance.
2 Perform K means
Clustering on given
dataset. Identify
number of clusters
using elbow method.
3 Perform hierarchical
clustering on given
dataset. Identify number
of clusters using
dendograms.
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 1
Link to Code:
Date:
Faculty Signature:
Grade:
xx
Machine
Learning Lab Manual (CSL 313)
2022
Objective(s):
Outcome:
Problem Statement:
Perform K-means clustering Algorithm. Write the python code to find Inter-cluster distance and Intra-Cluster
Distance.
Background Study: K-means clustering is a method of vector quantization, originally from signal
processing, that aims to partition n observations into k clusters in which each observation belongs
to the cluster with the nearest mean (cluster centers or cluster centroid), serving as a prototype of
the cluster.
Question Bank:
2. What is clustering?
Machine
Learning Lab Manual (CSL 313)
2022
import numpy as np
import math
%matplotlib inline
# Create Data
# n_samples
# If we pass int, it is the total number of points equally divided among clusters.
# and If we pass array, each element of the sequence indicates the number of samples per cluster.
# n_features
# centers
Machine
Learning Lab Manual (CSL 313)
2022
# If n_samples is array-like, centers must be either None or an array of length equal to the length
of n_samples.
# cluster_std
# random_state********************
# return_centers
plt.scatter(data[0][:,0],data[0][:,1],c=data[1],cmap='rainbow')
xxiii
Machine
Learning Lab Manual (CSL 313)
2022
kmeans = KMeans(n_clusters=4)
kmeans.fit(data[0])
kmeans.cluster_centers_
kmeans.labels_
ax1.set_title('K Means')
ax1.scatter(data[0][:,0],data[0][:,1],c=kmeans.labels_,cmap='rainbow')
ax2.set_title("Original")
ax2.scatter(data[0][:,0],data[0][:,1],c=data[1],cmap='plasma')
xxiv
Machine
Learning Lab Manual (CSL 313)
2022
import numpy as np
cluster1 = []
cluster2 = []
cluster3 = []
cluster4 = []
for j in range(0,200):
if kmeans.labels_[j] == i:
if i==0:
cluster1.append(distance)
xxv
Machine
Learning Lab Manual (CSL 313)
2022
print(distance)
elif i==1:
cluster2.append(distance)
print(distance)
elif i==2:
cluster3.append(distance)
print(distance)
else:
cluster4.append(distance)
print(distance)
inter_cluster =[]
for i in range(len(kmeans.cluster_centers_)):
Machine
Learning Lab Manual (CSL 313)
2022
inter_cluster.append(distance)
print(distance)
EXPERIMENT NO. 2
Link to Code:
xxvii
Machine
Learning Lab Manual (CSL 313)
2022
Date:
Faculty Signature:
Grade:
Objective(s):
Understand supervised and unsupervised learning.
Study about clustering and different clustering approaches.
Study about how to find the number of clusters in Kmeans clustering approach
Outcome:
Students would be familiarized with unsupervised learning and K-means clustering in particular.
Problem Statement:
Perform K means Clustering on given dataset. Identify number of clusters using elbow method .
Background Study:
K-means clustering is a method of vector quantization, originally from signal processing, that aims
to partition n observations into k clusters in which each observation belongs to the cluster with the
nearest mean (cluster centers or cluster centroid), serving as a prototype of the cluster.
In cluster analysis, the elbow method is a heuristic used in determining the number of clusters
in a data set. The method consists of plotting the explained variation as a function of the number
of clusters, and picking the elbow of the curve as the number of clusters to use.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
wcss = []
for i in range(1,15):
kmeans = KMeans(n_clusters=i)
kmeans.fit_predict(data[0])
wcss.append(kmeans.inertia_)
xxix
Machine
Learning Lab Manual (CSL 313)
2022
wcss
plt.title("Elbow Method")
plt.plot(range(1,15),wcss)
kmeans = KMeans(n_clusters=4)
kmeans.fit(data[0])
kmeans.cluster_centers_
kmeans.labels_
Machine
Learning Lab Manual (CSL 313)
2022
ax1.set_title('K Means')
ax1.scatter(data[0][:,0],data[0][:,1],c=kmeans.labels_,cmap='rainbow')
ax2.set_title("Original")
ax2.scatter(data[0][:,0],data[0][:,1],c=data[1],cmap='plasma')
xxxi
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 3
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Problem Statement:
Perform hierarchical clustering on given dataset. Identify number of clusters using dendograms
Background Study:
In data mining and statistics, hierarchical clustering (also called hierarchical cluster
analysis or HCA) is a method of cluster analysis which seeks to build a hierarchy of clusters.
xxxii
Machine
Learning Lab Manual (CSL 313)
2022
Question Bank:
1. What is a dendrogram?
4. What are the different distance metrics that can be used for Hierarchical clustering?
# Hierarchical Clustering
import numpy as np
%matplotlib inline
import pandas as pd
Machine
Learning Lab Manual (CSL 313)
2022
dataset = pd.read_csv('Mall_Customers.csv')
dataset
plt.figure(figsize=(10,7))
plt.title('Dendrogram')
plt.xlabel('Customer')
plt.ylabel('Euclidean distances')
xxxiv
Machine
Learning Lab Manual (CSL 313)
2022
plt.axhline(y=250, color='r',linestyle='-')
plt.axhline(y=200, color='r',linestyle='-')
plt.axhline(y=110, color='r',linestyle='-')
plt.show()
cluster=cluster.fit_predict(X)
Machine
Learning Lab Manual (CSL 313)
2022
plt.title('Clusters of customers')
plt.legend()
plt.show()
xxxvi
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 4
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Problem Statement:
Compare K-means and Hierarchical clustering for any one dataset. Calculate the Silhouette Score.
Background Study:
xxxvii
Machine
Learning Lab Manual (CSL 313)
2022
K-means is method of cluster analysis using a pre-specified no. of clusters. It requires advance
knowledge of ‘K’. Hierarchical clustering also known as hierarchical cluster analysis (HCA) is
also a method of cluster analysis which seeks to build a hierarchy of clusters without having
fixed number of clusters. In hierarchical clustering one can stop at any number of clusters and
find appropriate clusters by interpreting the dendrogram.
Question Bank:
import time
import warnings
import numpy as np
import pandas as pd
Machine
Learning Lab Manual (CSL 313)
2022
np.random.seed(0)
n_samples = 1500
random_state = 170
X, y = datasets.make_blobs(n_samples=n_samples, random_state=random_state)
aniso = (X_aniso, y)
varied = datasets.make_blobs(
)
xxxix
Machine
Learning Lab Manual (CSL 313)
2022
plt.subplots_adjust(
plot_num = 1
datasets = [
(blobs, {}),
(no_structure, {}),
Machine
Learning Lab Manual (CSL 313)
2022
params = default_base.copy()
params.update(algo_params)
X, y = dataset
X = StandardScaler().fit_transform(X)
# ============
# ============
ward = cluster.AgglomerativeClustering(
n_clusters=params["n_clusters"], linkage="ward"
complete = cluster.AgglomerativeClustering(
n_clusters=params["n_clusters"], linkage="complete"
average = cluster.AgglomerativeClustering(
n_clusters=params["n_clusters"], linkage="average"
single = cluster.AgglomerativeClustering(
xli
Machine
Learning Lab Manual (CSL 313)
2022
n_clusters=params["n_clusters"], linkage="single"
clustering_algorithms = (
t0 = time.time()
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
category=UserWarning,
)
xlii
Machine
Learning Lab Manual (CSL 313)
2022
algorithm.fit(X)
t1 = time.time()
if hasattr(algorithm, "labels_"):
y_pred = algorithm.labels_.astype(int)
else:
y_pred = algorithm.predict(X)
if i_dataset == 0:
plt.title(name, size=18)
colors = np.array(
list(
islice(
cycle(
"#377eb8",
"#ff7f00",
"#4daf4a",
"#f781bf",
"#a65628",
xliii
Machine
Learning Lab Manual (CSL 313)
2022
"#984ea3",
"#999999",
"#e41a1c",
"#dede00",
),
int(max(y_pred) + 1),
plt.xlim(-2.5, 2.5)
plt.ylim(-2.5, 2.5)
plt.xticks(())
plt.yticks(())
plt.text(
0.99,
0.01,
transform=plt.gca().transAxes,
size=15,
xliv
Machine
Learning Lab Manual (CSL 313)
2022
horizontalalignment="right",
plot_num += 1
plt.show()
xlv
Machine
Learning Lab Manual (CSL 313)
2022
plt.title('Dendrogram')
plt.xlabel('data')
plt.ylabel('Euclidean distances')
plt.show()
plt.title('Dendrogram')
xlvi
Machine
Learning Lab Manual (CSL 313)
2022
plt.xlabel('data')
plt.ylabel('Euclidean distances')
plt.show()
plt.title('Dendrogram')
plt.xlabel('data')
plt.ylabel('Euclidean distances')
plt.show()
xlvii
Machine
Learning Lab Manual (CSL 313)
2022
plt.title('Dendrogram')
plt.xlabel('data')
plt.ylabel('Euclidean distances')
plt.show()
xlviii
Machine
Learning Lab Manual (CSL 313)
2022
cluster=cluster.fit_predict(X)
plt.legend()
plt.show()
xlix
Machine
Learning Lab Manual (CSL 313)
2022
cluster=cluster.fit_predict(X)
plt.legend()
plt.show()
l
Machine
Learning Lab Manual (CSL 313)
2022
import pandas as pd
import numpy as np
X = df.iloc[:,:].values
km = KMeans(n_clusters=4)
y_means = km.fit_predict(X)
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 5
Link to Code:
Date:
lii
Machine
Learning Lab Manual (CSL 313)
2022
Faculty Signature:
Grade:
Objective(s):
Outcome:
Problem Statement:
Apply Apriori algorithm to identify frequent itemsets from the bakery dataset.
Background Study:
Apriori is an algorithm for frequent item set mining and association rule learning over relational
databases. It proceeds by identifying the frequent individual items in the database and extending
them to larger and larger item sets as long as those item sets appear sufficiently often in the
database.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
Algorithm/Flowchart/Code/Sample Outputs
import numpy as np
import pandas as pd
# Data Loading
transactions = []
Machine
Learning Lab Manual (CSL 313)
2022
# Inspecting elements
transactions[:3]
# min_support = items bought more than 3 times a day * 7 days (week) / 7500 customers =
0.0028
lv
Machine
Learning Lab Manual (CSL 313)
2022
# min_confidence: at least 20%, min_lift = minimum of 3 (less than that is too low)
# min_length: we want at least 2 items to be associated. No point in having a single item in the
result
results = list(rules)
lift = []
association = []
Machine
Learning Lab Manual (CSL 313)
2022
lift.append(results[:len(results)][i][2][0][3])
association.append(list(results[:len(results)][i][0]))
rank.sort_values('Lift', ascending=False).head(10)
lvii
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 6
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Machine
Learning Lab Manual (CSL 313)
2022
Outcome:
Problem Statement:
Apply ECLAT algorithm to identify frequent itemsets from the bakery dataset.
Background Study:
The ECLAT algorithm stands for Equivalence Class Clustering and bottom-up Lattice Traversal. It
is one of the popular methods of Association Rule mining. It is a more efficient and scalable
version of the Apriori algorithm.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 7
Link to Code:
Date:
lx
Machine
Learning Lab Manual (CSL 313)
2022
Faculty Signature:
Grade:
Objective(s):
Outcome:
Problem Statement:
Apply FP-growth algorithm to identify frequent itemsets from the bakery dataset.
Background Study:
Question Bank:
1. What is a FP-tree?
Machine
Learning Lab Manual (CSL 313)
2022
import pandas as pd
dataset = [['TFIOS', '5 feet apart', 'Walk to remember'], ['TFIOS', 'Walk to remember'],
['Divergent','Harry Potter']]
te = TransactionEncoder()
te_array = te.fit(dataset).transform(dataset)
df = pd.DataFrame(te_array, columns=te.columns_)
lxii
Machine
Learning Lab Manual (CSL 313)
2022
frequent_itemsets_fp
lxiii
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 08
Machine
Learning Lab Manual (CSL 313)
2022
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Problem Statement:
Background Study:
Recommender systems are information filtering systems that help deal with the problem of
information overload by filtering and segregating information and creating fragments out of large
amounts of dynamically generated information according to user’s preferences, interests, or
observed behavior about a particular item or items.
User-Based Collaborative Filtering is a technique used to predict the items that a user might like
on the basis of ratings given to that item by the other users who have similar taste with that of the
target user.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 09
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Problem Statement:
Background Study:
Machine
Learning Lab Manual (CSL 313)
2022
those items.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 10
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Machine
Learning Lab Manual (CSL 313)
2022
Problem Statement:
Background Study:
Matrix factorization is a way to generate latent features when multiplying two different kinds of
entities. Collaborative filtering is the application of matrix factorization to identify the relationship
between items’ and users’ entities
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 11
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
lxxii
Machine
Learning Lab Manual (CSL 313)
2022
Objective(s):
Outcome:
Problem Statement:
Background Study:
Principal component analysis is a statistical technique that is used to analyze the interrelationships
among a large number of variables and to explain these variables in terms of a smaller number of
variables, called principal components, with a minimum loss of information.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 12
Semester /Section:
lxxiv
Machine
Learning Lab Manual (CSL 313)
2022
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Students will be familiarized with Dimensionality Reduction especially Linear Discriminant Analysis
(LDA).
Problem Statement:
Background Study:
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 13
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Students will be familiarized with model building using feature selection techniques and
optimization.
Problem Statement:
Background Study:
lxxvii
Machine
Learning Lab Manual (CSL 313)
2022
Feature selection is the process of reducing the number of input variables when developing a
predictive model. It is desirable to reduce the number of input variables to both reduce the
computational cost of modeling and, in some cases, to improve the performance of the model.
Question Bank:
2. What are the advantages of Wrapper methods over filter methods for feature selection?
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 14
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Machine
Learning Lab Manual (CSL 313)
2022
Outcome:
Students will be familiarized with model building using feature selection techniques and
optimization.
Problem Statement:
Background Study: Recursive Feature Elimination (RFE) is popular feature selection method
because it is easy to configure and use and because it is effective at selecting those features
(columns) in a training dataset that are more or most relevant in predicting the target variable.
There are two important configuration options when using RFE: the choice in the number of
features to select and the choice of the algorithm used to help choose features. Both of these
hyperparameters can be explored, although the performance of the method is not strongly
dependent on these hyperparameters being configured well.
Question Bank:
3. Differentiate between Recursive Feature Elimination and Step Backward Feature Selection.
lxxx
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 15
Semester /Section:
Link to Code:
Date:
Faculty Signature:
lxxxii
Machine
Learning Lab Manual (CSL 313)
2022
Grade:
Objective(s):
Outcome:
Students will be able to understand how to build a highly efficient ML model (with high
performance), faster.
Problem Statement:
Background Study: XGBoost stands for “Extreme Gradient Boosting”. XGBoost is a decision-
tree-based ensemble Machine Learning algorithm that uses a gradient boosting framework.
XGBoost is an optimized distributed gradient boosting library designed to be highly efficient,
flexible and portable. It implements Machine Learning algorithms under the Gradient Boosting
framework. It provides a parallel tree boosting to solve many data science problems in a fast and
accurate way.
Question Bank:
4. What are the advantages offered by the XGBoost algorithm that make it superior to most
existing ML algorithms?
lxxxiii
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 16
lxxxiv
Machine
Learning Lab Manual (CSL 313)
2022
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Problem Statement:
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 18
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
Objective(s):
Outcome:
Students will be able to apply the model building concepts learned during ML and use to them
solve a real-world problem.
lxxxvi
i
Machine
Learning Lab Manual (CSL 313)
2022
Problem Statement:
Build a ML model from scratch using and comparing supervised, unsupervised ML approaches.
Background Study:
In machine learning, algorithms are trained according to the data available and the research
question at hand. But if researchers fail to identify the objective of the machine learning algorithm,
they will not be able to build an accurate model. Ultimately, the researchers need to identify the
problem at hand and which approaches would be more suitable to address the problem.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
EXPERIMENT NO. 19
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Grade:
lxxxix
Machine
Learning Lab Manual (CSL 313)
2022
Objective(s):
Outcome:
Students will be able to apply the feature selection a and dimensionality reduction techniques
learned in ML and apply them to solve a real-world problem.
Problem Statement:
Build a ML model from scratch applying and comparing filter, wrapper, embedded and hybrid
feature selection approaches and dimensionality reduction.
Background Study:
In machine learning, algorithms are trained according to the data available and the research
question at hand. But if researchers fail to identify the useful features from the not so useful
features, tis process can take a lot of time and resources. To optimize model building and
selection, students should be able to understand and incorporate feature selection and
dimensionality reduction.
Question Bank:
Machine
Learning Lab Manual (CSL 313)
2022
Annexure 2
Machine Learning
CSL313
Project Report
xci
Machine
Learning Lab Manual (CSL 313)
2022
Roll No.:
Semester:
Group:
Table of Contents
S.No Page
No.
1. Project Description
2. Problem Statement
xcii
Machine
Learning Lab Manual (CSL 313)
2022
3. Analysis
4. Design
6. Output (Screenshots)