AID 4th Semester Machine Learning Laboratory - Lab Manual2
AID 4th Semester Machine Learning Laboratory - Lab Manual2
4th Semester
2nd Semester
Deep Learning -
AD3501
Embedded Systems
Data and Information Human Values and
and IoT - CS3691
5th Semester
7th Semester
8th Semester
Open Elective-1
Distributed Computing Open Elective 2
- CS3551 Project Work /
Elective-3
Open Elective 3 Intership
Big Data Analytics - Elective-4
CCS334 Open Elective 4
Elective-5
Elective 1 Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering
lOMoARcPSD|45333583
www.BrainKart.com
School of Computing
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 1 / 57
lOMoARcPSD|45333583
www.BrainKart.com
CONTENTS
Write a program to demonstrate the working of the decision tree based on ID3 12
3
algorithm. Use an appropriate data set for building the decision tree and apply this
knowledge to classify a new sample.
Write a program to implement the Gaussian mixture model. Compute the accuracy
4 16
of the classifier, considering few test data sets.
Apply back propagation neural network on image data. The idea is to build a 19
5
Artificial Neural Network model that can effectively analyze and extract features
from an image.
Assuming a set of documents that need to be classified, use the Radial basis 23
6
function Classifier model to perform this task. Calculate the classification rate,
accuracy,
precision, and recall for your data set.
Write a program to construct a Hidden markov model for a medical data. Use this 30
7
model to demonstrate the diagnosis of medial data.
Apply EM algorithm to cluster a set of data. Use the same data set for clustering
37
8 using K- Means algorithm. Compare the results of these two algorithms and
comment on the quality of clustering. You can add Java/Python ML library
classes/API in the program.
Apply LDA algorithm to select the appropriate data from the given data set. Use 40
9
XG boost algorithm for classification.
Build a classification model that can effectively analyze and extract features from
10 46
an image. Apply PCA algorithm to find the appropriate feature.
Use case Implementation
11
2
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 2 / 57
lOMoARcPSD|45333583
www.BrainKart.com
1152CS234 ML LAB
Introduction
Machine learning
Machine learning is a subset of artificial intelligence in the field of computer science that often
uses statistical techniques to give computers the ability to "learn" (i.e., progressively improve
performance on a specific task) with data, without being explicitly programmed. In the past
decade, machine learning has given us self-driving cars, practical speech recognition, effective
web search, and a vastly improved understanding of the human genome.
Machine learning tasks are typically classified into two broad categories, depending on whether
there is a learning "signal" or "feedback" available to a learning system:
1. Supervised learning: The computer is presented with example inputs and their
desiredoutputs, given by a "teacher", and the goal is to learn a general rule that maps inputs to
outputs. As special cases, the input signal can be only partially available, or restricted to special
feedback:
3. Active learning: the computer can only obtain training labels for a limited set of instances
(based on a budget), and also has to optimize its choice of objects to acquire labels for. When
used interactively, these can be presented to the user for labeling.
4. Reinforcement learning: training data (in form of rewards and punishments) is given only as
feedback to the program's actions in a dynamic environment, such as driving a vehicle or playing
a game against an opponent.
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 3 / 57
lOMoARcPSD|45333583
www.BrainKart.com
5. Unsupervised learning: No labels are given to the learning algorithm, leaving it on its own to
find structure in its input. Unsupervised learning can be a goal in itself (discovering hidden
patterns in data) or a means towards an end (feature learning).
In classification, inputs are divided into two or more classes, and the learner must produce a
model that assigns unseen inputs to one or more (multi-label classification) of these classes. This
is typically tackled in a supervised manner. Spam filtering is an example of classification, where
the inputs are email (or other) messages and the classes are "spam" and "not spam".
In regression, also a supervised problem, the outputs are continuous rather than discrete.
In clustering, a set of inputs is to be divided into groups. Unlike in classification, the groups are
not known beforehand, making this typically an unsupervised task.
Dimensionality reduction simplifies inputs by mapping them into a lower dimensional space.
Topic modeling is a related problem, where a program is given a list of human language
documents and is tasked with finding out which documents cover similar topics.
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 4 / 57
lOMoARcPSD|45333583
www.BrainKart.com
4. Deep learning
Falling hardware prices and the development of GPUs for personal use in the last few years have
contributed to the development of the concept of deep learning which consists of multiple hidden
layers in an artificial neural network. This approach tries to model the way the human brain
processes light and sound into vision and hearing. Some successful applications of deep learning
are computer vision and speech Recognition.
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 5 / 57
lOMoARcPSD|45333583
www.BrainKart.com
of two categories, an SVM training algorithm builds a model that predicts whether a new
example falls into one category or the other.
7. Clustering
Cluster analysis is the assignment of a set of observations into subsets (called clusters) so that
observations within the same cluster are similar according to some pre designated criterion or
criteria, while observations drawn from different clusters are dissimilar. Different clustering
techniques make different assumptions on the structure of the data, often defined by some
similarity metric and evaluated for example by internal compactness (similarity between
members of the same cluster) and separation between different clusters. Other methods are
based on estimated density and graph connectivity. Clustering is a method of unsupervised
learning,and a common technique for statistical data analysis.
8. Bayesian networks
A Bayesian network, belief network or directed acyclic graphical model is a probabilistic
graphical model that represents a set of random variables and their conditional
independenciesvia a directed acyclic graph (DAG). For example, a Bayesian network could
represent the probabilistic relationships between diseases and symptoms. Given symptoms, the
network can be used to compute the probabilities of the presence of various diseases. Efficient
algorithms exist that perform inference and learning.
9. Reinforcement learning
Reinforcement learning is concerned with how an agent ought to take actions in an environment
so as to maximize some notion of long-term reward. Reinforcement learning algorithms attempt
to find a policy that maps states of the world to the actions the agent ought to take in those states.
Reinforcement learning differs from the supervised learning problem in that correct input/output
pairs are never presented, nor sub-optimal actions explicitly corrected.
10. Similarity and metric learning
In this problem, the learning machine is given pairs of examples that are considered similar and
pairs of less similar objects. It then needs to learn a similarity function (or a distance metric
function) that can predict if new objects are similar. It is sometimes used in Recommendation
systems.
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 6 / 57
lOMoARcPSD|45333583
www.BrainKart.com
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 7 / 57
lOMoARcPSD|45333583
www.BrainKart.com
1. Apply and demonstrate the FIND-S algorithm for finding the most specific Hypothesis
based on a given set of training data samples.
Find-s Algorithm :
1.Load Data set
2. Initialize h to the most specific hypothesis in H
3.For each positive training instance x
• For each attribute constraint ai in h
If the constraint ai in h is satisfied by x then do nothing
else replace ai in h by the next more general constraint that is satisfied by x
4.Output hypothesis h
Source Code:
import random
import csv
def read_data(filename):
with open(filename, 'r') as csvfile:
datareader = csv.reader(csvfile, delimiter=',')
traindata = []
for row in datareader:
traindata.append(row)
return (traindata)
h=['phi','phi','phi','phi','phi','phi'
data=read_data('finds.csv')
def isConsistent(h,d):
if len(h)!=len(d)-1:
print('Number of attributes are not same in hypothesis.')
return False
else:
matched=0
for i in range(len(h)):
if ( (h[i]==d[i]) | (h[i]=='any')
): matched=matched+1
if matched==len(h):
return True
else:
return False
def makeConsistent(h,d):
for i in
range(len(h)):
if((h[i] == 'phi')):
h[i]=d[i]
elif(h[i]!=d[i]):
h[i]='any'
return h
print('Begin : Hypothesis :',h)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 8 / 57
lOMoARcPSD|45333583
www.BrainKart.com
print('==========================================')
for d in data:
if d[len(d)-1]=='Yes':
if ( isConsistent(h,d)):
pass
else:
h=makeConsistent(h,d)
print ('Training data :',d)
print ('Updated Hypothesis :',h)
print()
print(' ')
print('==========================================')
print('maximally sepcific data set End: Hypothesis :',h)
Output:
Begin : Hypothesis : ['phi', 'phi', 'phi', 'phi', 'phi', 'phi']
==========================================
Training data : ['Cloudy', 'Cold', 'High', 'Strong', 'Warm', 'Change', 'Yes']
Updated Hypothesis : ['Cloudy', 'Cold', 'High', 'Strong', 'Warm', 'Change']
==========================================
maximally sepcific data set End: Hypothesis : ['any', 'any', 'any', 'Strong', 'any',
'any'] OR
import csv
def loadCsv(filename):
lines = csv.reader(open(filename, "r"))
dataset = list(lines)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 9 / 57
lOMoARcPSD|45333583
www.BrainKart.com
for i in
range(len(dataset)):
dataset[i] = dataset[i]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 10 / 57
lOMoARcPSD|45333583
www.BrainKart.com
return dataset
attributes = ['Sky','Temp','Humidity','Wind','Water','Forecast']
print('Attributes =',attributes)
num_attributes = len(attributes)
filename = "finds.csv"
dataset = loadCsv(filename)
print(dataset)
hypothesis=['0'] * num_attributes
print("Intial Hypothesis")
print(hypothesis)
print("The Hypothesis are")
for i in range(len(dataset)):
target = dataset[i][-1]
if(target == 'Yes'):
for j in
range(num_attributes):
if(hypothesis[j]=='0'):
hypothesis[j] = dataset[i][j]
if(hypothesis[j]!= dataset[i][j]):
hypothesis[j]='?'
print(i+1,'=',hypothesis)
print("Final Hypothesis")
print(hypothesis)
Output:
Attributes = ['Sky', 'Temp', 'Humidity', 'Wind', 'Water', 'Forecast']
[['sky', 'Airtemp', 'Humidity', 'Wind', 'Water', 'Forecast', 'WaterSport'],
['Cloudy', 'Cold', 'High', 'Strong', 'Warm', 'Change', 'Yes'],
['Sunny', 'Warm', 'Normal', 'Strong', 'Warm', 'Same', 'Yes'],
['Sunny', 'Warm', 'High', 'Strong', 'Warm', 'Same', 'Yes'],
['Cloudy', 'Cold', 'High', 'Strong', 'Warm', 'Change', 'No'],
['Sunny', 'Warm', 'High', 'Strong', 'Cool', 'Change', 'Yes'],
['Rain', 'Mild', 'High', 'Weak', 'Cool', 'Change', 'No'],
['Rain', 'Cool', 'Normal', 'Weak', 'Cool', 'Same', 'No'],
['Overcast', 'Cool', 'Normal', 'Strong', 'Warm', 'Same', 'Yes']]
Intial Hypothesis
['0', '0', '0', '0', '0',
'0']
The Hypothesis are
2 = ['Cloudy', 'Cold', 'High', 'Strong', 'Warm', 'Change']
3 = ['?', '?', '?', 'Strong', 'Warm', '?']
4 = ['?', '?', '?', 'Strong', 'Warm', '?']
6 = ['?', '?', '?', 'Strong', '?', '?']
9 = ['?', '?', '?', 'Strong', '?', '?']
Final Hypothesis
['?', '?', '?', 'Strong', '?', '?']
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 11 / 57
lOMoARcPSD|45333583
www.BrainKart.com
2. Implement and demonstrate the Candidate-Elimination algorithm to output a description of the set of all
hypotheses consistent with the training examples.
Candidate-Elimination Algorithm:
1. Load data set
2. G <-maximally general hypotheses in H
3. S <- maximally specific hypotheses in H
4. For each training example
d=<x,c(x)>Case 1 : If d is a positive
example
Remove from G any hypothesis that is inconsistent with
dFor each hypothesis s in S that is not consistent with d
• Remove s from S.
• Add to S all minimal generalizations h of s such that
• h consistent with d
• Some member of G is more general than h
• Remove from S any hypothesis that is more general than another hypothesis in S
Source Code:
import numpy as
np import pandas
as pd
data =
pd.DataFrame(data=pd.read_csv('finds1.csv'))
concepts = np.array(data.iloc[:,0:-1])
target = np.array(data.iloc[:,-1])
def learn(concepts, target):
specific_h = concepts[0].copy()
print("initialization of specific_h and
general_h") print(specific_h)
general_h = [["?" for i in range(len(specific_h))] for i in
range(len(specific_h))] print(general_h)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 12 / 57
lOMoARcPSD|45333583
www.BrainKart.com
for i, h in
enumerate(concepts): if
target[i] == "Yes":
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 13 / 57
lOMoARcPSD|45333583
www.BrainKart.com
for x in
range(len(specific_h)): if
h[x] != specific_h[x]:
specific_h[x] = '?'
general_h[x][x] = '?'
if target[i] == "No":
for x in
range(len(specific_h)): if
h[x] != specific_h[x]:
general_h[x][x] = specific_h[x]
else:
general_h[x][x] = '?'
print(" steps of Candidate Elimination
Algorithm",i+1) print("Specific_h ",i+1,"\n ")
print(specific_h)
print("general_h ", i+1, "\n ")
print(general_h)
indices = [i for i, val in enumerate(general_h) if val == ['?', '?', '?', '?', '?',
'?']] for i in indices:
general_h.remove(['?', '?', '?', '?', '?', '?'])
OUTPUT
initialization of specific_h and general_h
['Cloudy' 'Cold' 'High' 'Strong' 'Warm' 'Change']
[['?', '?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?', '?'], ['?', '?', '?',
'?', '?', '?'], ['?', '?', '?', '?', '?', '?']]
steps of Candidate Elimination Algorithm
8 Specific_h 8
[['?', '?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?', '?'], ['?', '?', '?', 'Strong', '?', '?'], ['?',
'?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?', '?']]
Final Specific_h:
['?' '?' '?' 'Strong' '?' '?']
Final General_h:
[['?', '?', '?', 'Strong', '?', '?']]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 14 / 57
lOMoARcPSD|45333583
www.BrainKart.com
3. Write a program to demonstrate the working of the decision tree based on ID3 algorithm. Use an appropriate
data set for building the decision tree and apply this knowledge to classify a new sample.
Outlook
no yes yes no
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 15 / 57
lOMoARcPSD|45333583
www.BrainKart.com
Source Code:
import numpy as
np import math
from data_loader import read_data
class Node:
def init (self, attribute):
self.attribute = attribute
self.children = []
self.answer = ""
def str (self):
return self.attribute
def subtables(data, col,
delete): dict = {}
items = np.unique(data[:, col])
count = np.zeros((items.shape[0], 1), dtype=np.int32)
for x in range(items.shape[0]):
for y in
range(data.shape[0]):
if data[y, col] == items[x]:
count[x] += 1
for x in range(items.shape[0]):
dict[items[x]] = np.empty((int(count[x]), data.shape[1]), dtype="|
S32") pos = 0
for y in range(data.shape[0]):
if data[y, col] == items[x]:
dict[items[x]][pos] = data[y]
pos += 1
if delete:
dict[items[x]] = np.delete(dict[items[x]], col, 1)
return items, dict
def entropy(S):
items = np.unique(S)
if items.size ==
1: return 0
counts = np.zeros((items.shape[0], 1))
sums = 0
for x in range(items.shape[0]):
counts[x] = sum(S == items[x]) / (S.size * 1.0)
for count in counts:
sums += -1 * count * math.log(count, 2)
return sums
def gain_ratio(data, col):
items, dict = subtables(data, col, delete=False)
total_size = data.shape[0]
entropies = np.zeros((items.shape[0], 1))
intrinsic = np.zeros((items.shape[0], 1))
for x in range(items.shape[0]):
ratio = dict[items[x]].shape[0]/(total_size * 1.0)
entropies[x] = ratio * entropy(dict[items[x]][:, -1])
intrinsic[x] = ratio * math.log(ratio, 2)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 16 / 57
lOMoARcPSD|45333583
www.BrainKart.com
metadata, traindata =
read_data("tennis.data") data =
np.array(traindata)
node = create_node(data,
metadata) print_tree(node, 0)
OUTPUT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 17 / 57
lOMoARcPSD|45333583
www.BrainKart.com
outlook
overcast
b'yes'
rain
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 18 / 57
lOMoARcPSD|45333583
www.BrainKart.com
wind
b'strong'
b'no'
b'weak'
b'yes'
sunny
humidity
b'high'
b'no'
b'normal'
b'yes'
OR
import pandas as
pd import numpy
as np
dataset= pd.read_csv('playtennis.csv',names=['outlook','temperature','humidity','wind','class',])
def entropy(target_col):
elements,counts = np.unique(target_col,return_counts = True)
entropy = np.sum([(-counts[i]/np.sum(counts))*np.log2(counts[i]/np.sum(counts)) for i in
range(len(elements))])
return entropy
def InfoGain(data,split_attribute_name,target_name="class"):
total_entropy = entropy(data[target_name])
vals,counts= np.unique(data[split_attribute_name],return_counts=True)
Weighted_Entropy =
np.sum([(counts[i]/np.sum(counts))*entropy(data.where(data[split_attribute_name]==vals[i]).dr opna()
[target_name]) for i in range(len(vals))])
Information_Gain = total_entropy - Weighted_Entropy
return Information_Gain
def ID3(data,originaldata,features,target_attribute_name="class",parent_node_class =
None): if len(np.unique(data[target_attribute_name])) <= 1:
return np.unique(data[target_attribute_name])[0]
elif len(data)==0:
return np.unique(originaldata[target_attribute_name])
[np.argmax(np.unique(originaldata[target_attribut e_name],return_counts=True)[1])]
elif len(features) ==0:
return parent_node_class
else:
parent_node_class =
np.unique(data[target_attribute_name])[np.argmax(np.unique(data[target_attribute_name],return
_counts=True)[1])]
item_values = [InfoGain(data,feature,target_attribute_name) for feature in features] #Return
the information gain values for the features in the dataset
best_feature_index = np.argmax(item_values)
best_feature = features[best_feature_index]
tree = {best_feature:{}}
features = [i for i in features if i !=
best_feature] for value in
np.unique(data[best_feature]):
value = value
sub_data = data.where(data[best_feature] == value).dropna()
subtree = ID3(sub_data,dataset,features,target_attribute_name,parent_node_class) tree[best_feature]
[value] = subtree
return(tree)
tree = ID3(dataset,dataset,dataset.columns[:-1])
print(' \nDisplay Tree\n',tree)
OUTPUT:
Display Tree
{'outlook': {'Overcast': 'Yes', 'Rain': {'wind': {'Strong': 'No', 'Weak': 'Yes'}}, 'Sunny':
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 19 / 57
lOMoARcPSD|45333583
www.BrainKart.com
{'humidity': {'High': 'No', 'Normal': 'Yes'}}}}4.
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 20 / 57
lOMoARcPSD|45333583
www.BrainKart.com
Task 4: Write a program to implement the Gaussian mixture model. Compute the accuracy of the classifier,
considering few test data sets.
Algorithm
1. Initialize the mean μk, the covariance matrix k, and the mixing coefficients k by some random
variables.
2. Compute the k
3. Again, estimate all the parameters using the current k values
4. Compute log-likelihood function.
5. Put some convergence criterion
6. If the log-likelihood value converges to some value ( or if all the parameters converge to some values
) then stop, else return to Step 2.
Python Code
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pandas import DataFrame
from sklearn import datasets
from sklearn.mixture import GaussianMixture
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 21 / 57
lOMoARcPSD|45333583
www.BrainKart.com
output:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 22 / 57
lOMoARcPSD|45333583
www.BrainKart.com
[[0.36153508 0.05159664]
[0.05159664 0.08927917]]
[[0.11944714 0.08835648]
[0.08835648 0.11893388]]]
The converged log-likelihood value: -1.4987505566235166
The number of iterations needed for the log-likelihood value to converge: 8
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 23 / 57
lOMoARcPSD|45333583
www.BrainKart.com
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 24 / 57
lOMoARcPSD|45333583
www.BrainKart.com
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 25 / 57
lOMoARcPSD|45333583
www.BrainKart.com
end
import numpy as np
X = np.array(([2, 9], [1, 5], [3, 6]), dtype=float)
y = np.array(([92], [86], [89]), dtype=float)
X = X/np.amax(X,axis=0) # maximum of X array longitudinally y = y/100
#Sigmoid Function
def sigmoid (x):
return (1/(1 + np.exp(-x)))
#Derivative of Sigmoid
Function def
derivatives_sigmoid(x):
return x * (1 - x)
#Variable initialization
epoch=7000 #Setting training iterations
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 26 / 57
lOMoARcPSD|45333583
www.BrainKart.com
lr=0.1 #Setting learning rate
inputlayer_neurons = 2 #number of features in data set
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 27 / 57
lOMoARcPSD|45333583
www.BrainKart.com
bout=np.random.uniform(size=(1,output_neurons))
# draws a random range of numbers uniformly of dim x*y
#Forward Propagation
for i in range(epoch):
hinp1=np.dot(X,wh)
hinp=hinp1 + bh
hlayer_act =
sigmoid(hinp)
outinp1=np.dot(hlayer_act,wout)
outinp= outinp1+ bout
output = sigmoid(outinp)
#Backpropagation
EO = y-output
outgrad =
derivatives_sigmoid(output) d_output
= EO* outgrad
EH = d_output.dot(wout.T)
hiddengrad = derivatives_sigmoid(hlayer_act)
#how much hidden layer wts contributed to error
d_hiddenlayer = EH * hiddengrad
wout += hlayer_act.T.dot(d_output) *lr
# dotproduct of nextlayererror and currentlayerop
bout += np.sum(d_output, axis=0,keepdims=True)
*lr wh += X.T.dot(d_hiddenlayer) *lr
#bh += np.sum(d_hiddenlayer, axis=0,keepdims=True) *lr
print("Input: \n" + str(X))
print("Actual Output: \n" + str(y))
print("Predicted Output: \n"
,output)
Output:
Input:
[[ 0.66666667 1. ]
[ 0.33333333 0.55555556]
[ 1. 0.66666667]]
Actual Output:
[[ 0.92]
[ 0.86]
[ 0.89]]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 28 / 57
lOMoARcPSD|45333583
www.BrainKart.com
Predicted Output:
[[ 0.89559591]
[ 0.88142069]
[ 0.8928407 ]]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 29 / 57
lOMoARcPSD|45333583
www.BrainKart.com
ML LAB
6. Task 6: Assuming a set of documents that need to be classified, use the Radial basis function Classifier
model to perform this task. Calculate the classification rate, accuracy, precision, and recall for your data
set.
Methodology
Radial basis function network (or RBFN for short) is an artificial neural network that uses radial basis
functions as activation functions. The output of the network is a linear combination of radial basis
functions of the inputs and neuron parameters.
Requirements:
Train
Training will import the 60,000 training examples and train using that data. Finally the weights and
centers (used for RBF) will be saved.
By default, centers/centriods for the RBF neurons are selected as the first 300 training examples. K-
means cluserting can also be used to get centers by setting useKMeans to True. If kMeans is used then
remember to lower the numbers of centers from 300 otherwise training will take considerably long time.
Predict
Predict will import the 10,000 test examples and the weights (weights.npy). Using the weights, the
Network will predict results and compare and finally compute the classification accuracy of the Network.
Learning Curves
For diagnostics, other than classification accuracy, you can plot the learning curves to check how the
Network is learning. The function plotLearningCurves is included and can be called after predicting.
Training Data
Training Data used from MNIST Database. 60,000 training examples and 10,000 test examples.
The data is in text files and zipped (compressed file size: 20.6 Mb).
Network Structure
Architecture
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 30 / 57
lOMoARcPSD|45333583
www.BrainKart.com
have 1 neuron which propogates each training example of 784 features to the hidden layer RBF
Neurons
The centers c are selected based on random sampling of 300 data samples.
Centers can also be chosen using the k-means clustering algorithm available in the file. However, by
default, using k-means cluserting has been set to False, and instead we use the random sampling.
Backpropogation
Backpropogation uses stochastic gradient descent to update weights connecting hidden layer to output
layer.
Performance
The parameters used for this performance test are as below. These parameters have been fixed (hard-
coded) as of now, but can be changed as you wish from the Network.py code.
Parameters Value
beta 0.05
Learning rate 0.3
Num of Epochs 1
Training using all 60,000 examples takes around 3-4 minutes. Code
import
numpy
as np
import time
import re
import sys
import math
import matplotlib.pyplot as plt
np.set_printoptions(threshold=sys.maxsize, suppress=True)
np.random.seed(1)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 31 / 57
lOMoARcPSD|45333583
www.BrainKart.com
dataSize = 10000
data = sampleData[:dataSize]
for i in range(15):
centeriodSums = np.zeros(shape=centeriods.shape)
centeriodSumsCounter = np.zeros(shape=K)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 32 / 57
lOMoARcPSD|45333583
www.BrainKart.com
for x in data:
# Get index of closest centeriod to X (minimum of ||C - X||)
index = np.argmin(np.square(centeriods - x).sum(axis=1))
centeriodSums[index] += x
centeriodSumsCounter[index] += 1
return centeriods
class Network:
def init (self):
self.XSize = 0
self.HSize = 300
self.OSize = 10
self.X = []
self.C = []
self.Y = []
self.W = []
# self.B = np.random.uniform(-1, 1, (self.OSize))
self.trainErrors = []
self.testErrors = []
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 33 / 57
lOMoARcPSD|45333583
www.BrainKart.com
else:
self.C = self.X[: self.HSize]
def predict(self):
"""Predicts using the Network by the set parameters (weight and
centers) and displays the accuracy
"""
self.testErrors = np.zeros(shape=self.XSize) # Preallocating numpy array
print("Prediciting...")
totalAvg = count = correctCount = 0.0
# Take each data sample from the inputData
for count, x in enumerate(self.X):
HLayer = rbf(x, self.C)
output = np.dot(HLayer, self.W) # + self.B
o = np.argmax(output)
y = np.argmax(self.Y[count])
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 34 / 57
lOMoARcPSD|45333583
www.BrainKart.com
if o == y:
correctCount += 1
myNetwork = Network()
while True:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 35 / 57
lOMoARcPSD|45333583
www.BrainKart.com
ML LAB
print("1. Train the RBF Network\n2. Predict using the RBF Network")
userInput = input("Choose your option: ")
if userInput == "1":
print("Importing data for training...")
startTime = time.time()
myNetwork.loadData("train.txt", "train-labels.txt", trainDataSize)
print(
f"{trainDataSize} training examples imported in {time.time()-startTime:.2f} sec"
)
startTrainingTime = time.time()
myNetwork.train(epochs=1, learnRate=0.3, K=300, useKMeans=False)
print(f"Training took: {time.time()-startTrainingTime:.2f} sec")
elif userInput == "2":
# Loading centers and weights from save file
filename = input("Enter file name containing weights (default: weights.npy): ")
myNetwork.W = np.load(filename)
myNetwork.C = np.load("centers.npy")
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 36 / 57
lOMoARcPSD|45333583
www.BrainKart.com
ML LAB
7. Write a program to construct a Hidden markov model for a medical data. Use this model to demonstrate
the diagnosis of medial data.
Methodology
Hidden Markov models are used to ferret out the underlying, or hidden, sequence of states that generates
a set of observations. In his now canonical toy example, Jason Eisner uses a series of daily ice cream
consumption (1, 2, 3) to understand Baltimore's weather for a given summer (Hot/Cold days). These are
arrived at using transmission probabilities (i.e. the likelihood of moving from one state to another) and
emission probabilities (i.e. the likelihood of seeing a particular observation given an underlying state).
This implementation adopts his approach into a system that can take:
You can see an example input by using the main() function call on the hmm.py file.
HMM models calculate first the probability of a given sequence and its individual observations for
possible hidden state sequences, then re-calculate the matrices above given those probabilities. By
iterating back and forth (what's called an expectation-maximization process), the model arrives at a local
optimum for the tranmission and emission probabilities. It's a pretty good outcome for what might
otherwise be a very hefty computationally difficult problem.
This model implements the forward-backward algorithm recursively for probability calculation within the
broader expectation-maximization pattern.
Code
import copy
import numpy as np
class HMM():
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 37 / 57
lOMoARcPSD|45333583
www.BrainKart.com
def assume_obs(self):
'''
If observation labels are not given, will assume that the emission
probabilities are in alpha-numerical order.
'''
obs = list(set(list(self.observations)))
obs.sort()
for i in range(len(obs)):
self.emiss_ref[obs[i]] = i
return obs
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 38 / 57
lOMoARcPSD|45333583
www.BrainKart.com
if verbose:
print("Iteration: {}".format(i + 1))
self.expectation()
self.maximization()
def expectation(self):
'''
Executes expectation step.
'''
self.forward = self.forward_recurse(len(self.observations))
self.backward = self.backward_recurse(0)
self.get_gamma()
self.get_psi()
def get_gamma(self):
'''
Calculates the gamma matrix.
'''
self.gamma = [[0, 0] for i in range(len(self.observations))]
for i in range(len(self.observations)):
self.gamma[i][0] = (float(self.forward[0][i] * self.backward[0][i]) /
float(self.forward[0][i] * self.backward[0][i] +
self.forward[1][i] * self.backward[1][i]))
self.gamma[i][1] = (float(self.forward[1][i] * self.backward[1][i]) /
float(self.forward[0][i] * self.backward[0][i] +
self.forward[1][i] * self.backward[1][i]))
def get_psi(self):
'''
Runs the psi calculation.
'''
for t in range(1, len(self.observations)):
for j in range(self.n):
for i in range(self.n):
self.psi[i][j][t-1] = self.calculate_psi(t, i, j)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 39 / 57
lOMoARcPSD|45333583
www.BrainKart.com
def maximization(self):
'''
Executes maximization step.
'''
self.get_state_probs()
for i in range(self.n):
self.transmission_prob[i+1][0] = self.gamma[0][i]
self.transmission_prob[-1][i+1] = self.gamma[-1][i] / self.state_probs[i]
for j in range(self.n):
self.transmission_prob[j+1][i+1] = self.estimate_transmission(i, j)
for obs in range(self.m):
self.emission_prob[obs][i] = self.estimate_emission(i, obs)
def get_state_probs(self):
'''
Calculates total probability of a given state.
'''
self.state_probs = [0] * self.n
for state in range(self.n):
summ = 0
for row in self.gamma:
summ += row[state]
self.state_probs[state] = summ
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 40 / 57
lOMoARcPSD|45333583
www.BrainKart.com
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 41 / 57
lOMoARcPSD|45333583
www.BrainKart.com
else:
forward = self.forward_recurse(index-1)
for state in range(self.n):
if index != len(self.observations):
forward[state][index] = self.forward_probability(index, forward, state)
else:
# Termination
self.forward_final[state] = self.forward_probability(index, forward, state, final=True)
return forward
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 42 / 57
lOMoARcPSD|45333583
www.BrainKart.com
# http://www.cs.jhu.edu/~jason/papers/#eisner-2002-tnlp
emission = np.array([[0.7, 0], [0.2, 0.3], [0.1, 0.7]])
transmission = np.array([ [0, 0, 0, 0], [0.5, 0.8, 0.2, 0], [0.5, 0.1, 0.7, 0], [0, 0.1, 0.1, 0]])
observations = ['2','3','3','2','3','2','3','2','2','3','1','3','3','1','1',
'1','2','1','1','1','3','1','2','1','1','1','2','3','3','2',
'3','2','2']
model = HMM(transmission, emission)
model.train(observations)
print("Model transmission probabilities:\n{}".format(model.transmission_prob))
print("Model emission probabilities:\n{}".format(model.emission_prob))
# Probability of a new sequence
new_seq = ['1', '2', '3']
print("Finding likelihood for {}".format(new_seq))
likelihood = model.likelihood(new_seq)
print("Likelihood: {}".format(likelihood))
Output:
Iteration: 1
Iteration: 2
Iteration: 3
Iteration: 4
Iteration: 5
Iteration: 6
Iteration: 7
Iteration: 8
Iteration: 9
Iteration: 10
Model transmission probabilities:
[[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
[1.44069481e-13 9.33776929e-01 7.18678407e-02 0.00000000e+00]
[1.00000000e+00 6.62230707e-02 8.64943107e-01 0.00000000e+00]
[0.00000000e+00 3.10801009e-14 6.31890522e-02 0.00000000e+00]]
Model emission probabilities:
[[0.64048542 0. ]
[0.14806851 0.5343899 ]
[0.21144608 0.4656101 ]]
Finding likelihood for ['1', '2', '3']
Likelihood: 3.2956914388507033e-15
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 43 / 57
lOMoARcPSD|45333583
www.BrainKart.com
8. Apply EM algorithm to cluster a set of data. Use the same data set for clustering using K- Means
algorithm. Compare the results of these two algorithms and comment on the quality of clustering. You
can add Java/Python ML library classes/API in the program.
K- Means Algorithm
Step-1: Select the number K to decide the number of clusters.
Step-2: Select random K points or centroids. (It can be other from the input dataset).
Step-3: Assign each data point to their closest centroid, which will form the predefined K
clusters. Step-4: Calculate the variance and place a new centroid of each cluster.
Step-5: Repeat the third steps, which means reassign each datapoint to the new closest centroid of each
cluster.
Step-6: If any reassignment occurs, then go to step-4 else go to FINISH.
Step-7: The model is ready.
Code
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.cluster import KMeans
import sklearn.metrics as sm
import pandas as pd
import numpy as np
iris = datasets.load_iris()
X = pd.DataFrame(iris.data)
X.columns = ['Sepal_Length','Sepal_Width','Petal_Length','Petal_Width']
y = pd.DataFrame(iris.target)
y.columns = ['Targets']
model = KMeans(n_clusters=3)
model.fit(X)
plt.figure(figsize=(14,7))
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 44 / 57
lOMoARcPSD|45333583
www.BrainKart.com
plt.subplot(1, 2, 1)
plt.scatter(X.Petal_Length, X.Petal_Width, c=colormap[y.Targets], s=40)
plt.title('Real Classification')
plt.xlabel('Petal Length')
plt.ylabel('Petal Width')
y_gmm = gmm.predict(xs)
#y_cluster_gmm
plt.subplot(2, 2, 3)
plt.scatter(X.Petal_Length, X.Petal_Width, c=colormap[y_gmm], s=40)
plt.title('GMM Classification')
plt.xlabel('Petal Length')
plt.ylabel('Petal Width')
Output
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 45 / 57
lOMoARcPSD|45333583
www.BrainKart.com
[ 0 45 5]
[ 0 0 50]]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 46 / 57
lOMoARcPSD|45333583
www.BrainKart.com
Taks 9:
Apply LDA algorithm to select the appropriate data from the given data set. Use XG boost algorithm for
classification.
Algorithm
2. Compute the eigenvectors and corresponding eigenvalues for the scatter matrices
5. Obtain the new features (i.e. LDA components) by taking the dot product of the data and
the matrix from step 4
Code
# In[ ]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from numpy import linalg as lg
get_ipython().magic(u'matplotlib inline')
df =
pd.read_csv('C:/Users/vyoms/Desktop/SCLC_study_output_filtered_2.csv',header
=None)
df1 = df.drop(df.index[0])
df3 = df2
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 47 / 57
lOMoARcPSD|45333583
www.BrainKart.com
df3_1 = df2.values[0:20,:]
df3_2 = df2.values[20:, : ]
m_1 = df3_1.mean(axis = 0)
m_2 = df3_2.mean(axis = 0)
mean_all = df2.mean(axis = 0)
mean_1 = m_1.reshape(1,19)
mean_1 = np.repeat(mean_1,20,axis = 0)
mean_2 = m_2.reshape(1,19)
mean_2 = np.repeat(mean_2,20,axis = 0)
within_class_scatter = np.zeros((19,19))
wcs_1 = np.zeros((19,19))
wcs_1 = np.matmul((np.transpose(df3_1 - mean_1 )), (df3_1 - mean_1))
wcs_2 = np.zeros((19,19))
wcs_2 = np.matmul((np.transpose(df3_2 - mean_2 )), (df3_2 - mean_2))
within_class_scatter = np.add(wcs_1,wcs_2)
between_class_scatter = np.add(bcs_1,bcs_2)
e_val, e_vector =
np.linalg.eig(np.dot(lg.inv(within_class_scatter),between_class_scatter))
for e in range (len(e_val)):
e_scatter = e_vector[:,e].reshape(19,1)
print(e_val[e].real)
print(between_class_scatter)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 48 / 57
lOMoARcPSD|45333583
www.BrainKart.com
W= eig_pairs[0][1].reshape(19,1)
lda_project = np.dot(df2,W)
lda_project
# In[177]:
#plot
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.set_title('LDA')
ax.plot(lda_project[0:20], np.zeros(20), linestyle='None', marker='o', color='blue',
label='NSCLC')
ax.plot(lda_project[20:40], np.zeros(20), linestyle='None', marker='o', color='red',
label='SCLC')
fig.show()
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 49 / 57
lOMoARcPSD|45333583
www.BrainKart.com
ML LAB
# In[185]:
y1_ = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
# LDA
sklearn_lda = LDA(n_components=1)
X_lda_sklearn = sklearn_lda.fit_transform(df2, y1_)
X_lda_sklearn= -X_lda_sklearn
print(X_lda_sklearn)
#plot
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.set_title('LDA')
ax.plot(X_lda_sklearn[0:20], np.zeros(20), linestyle='None', marker='o',
color='blue', label='NSCLC')
ax.plot(X_lda_sklearn[20:40], np.zeros(20), linestyle='None', marker='o',
color='red', label='SCLC')
fig.show()
Output
[ 3.15378176]
[ 4.86686796]
[ 2.81120157]
[ 3.93543558]
[ 3.39771836]
[ 3.25628819]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 50 / 57
lOMoARcPSD|45333583
www.BrainKart.com
ML LAB
[-4.49065733]
[-4.6115194 ]
[-3.45215203]
[-2.75643608]
[-3.83408221]
[-3.54607243]
[-3.25235288]
[-3.40306303]
[-4.04197759]
[-4.35872643]
[-5.76347876]
[-5.589837 ]
[-5.74304609]
[-3.85936631]
[-3.13967526]
[-3.56371641]
[-5.68605839]
[-4.9237813 ]
[-3.53641015]
[-4.242908 ]]
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 51 / 57
lOMoARcPSD|45333583
www.BrainKart.com
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 52 / 57
lOMoARcPSD|45333583
www.BrainKart.com
Task 10
Build a classification model that can effectively analyze and extract features from an image. Apply PCA
algorithm to find the appropriate feature.
Algorithm
Step 1: Standardize the dataset.
Step 2: Calculate the covariance matrix for the features in the dataset.
Step 3: Calculate the eigenvalues and eigenvectors for the covariance matrix.
Step 4: Sort eigenvalues and their corresponding eigenvectors.
Step 5: Pick k eigenvalues and form a matrix of eigenvectors.
Step 6: Transform the original matrix.
Code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
df = pd.read_csv('wine.data.csv')
df.head(10)
df.iloc[:,1:].describe()
for c in df.columns[1:]:
df.boxplot(c,by='Class',figsize=(7,4),fontsize=14)
plt.title("{}\n".format(c),fontsize=16)
plt.xlabel("Wine Class", fontsize=16)
plt.figure(figsize=(10,6))
plt.scatter(df['OD280/OD315 of diluted
wines'],df['Flavanoids'],c=df['Class'],edgecolors='k',alpha=0.75,s=150)
plt.grid(True)
plt.title("Scatter plot of two features showing the \ncorrelation and class seperation",fontsize=15)
plt.xlabel("OD280/OD315 of diluted wines",fontsize=15)
plt.ylabel("Flavanoids",fontsize=15)
plt.show()
def correlation_matrix(df):
from matplotlib import pyplot as plt
from matplotlib import cm as cm
fig = plt.figure(figsize=(16,12))
ax1 = fig.add_subplot(111)
cmap = cm.get_cmap('jet', 30)
cax = ax1.imshow(df.corr(), interpolation="nearest", cmap=cmap)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 53 / 57
lOMoARcPSD|45333583
www.BrainKart.com
ax1.grid(True)
plt.title('Wine data set features correlation\n',fontsize=15)
labels=df.columns
ax1.set_xticklabels(labels,fontsize=9)
ax1.set_yticklabels(labels,fontsize=9)
# Add colorbar, make sure to specify tick locations to match desired ticklabels
fig.colorbar(cax, ticks=[0.1*i for i in range(-11,11)])
plt.show()
correlation_matrix(df)
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X = df.drop('Class',axis=1)
y = df['Class']
X = scaler.fit_transform(X)
dfx = pd.DataFrame(data=X,columns=df.columns[1:])
dfx.head(10)
dfx.describe()
from sklearn.decomposition import PCA
pca = PCA(n_components=None)
dfx_pca = pca.fit(dfx)
plt.figure(figsize=(10,6))
plt.scatter(x=[i+1 for i in range(len(dfx_pca.explained_variance_ratio_))],
y=dfx_pca.explained_variance_ratio_,
s=200, alpha=0.75,c='orange',edgecolor='k')
plt.grid(True)
plt.title("Explained variance ratio of the \nfitted principal component vector\n",fontsize=25)
plt.xlabel("Principal components",fontsize=15)
plt.xticks([i+1 for i in range(len(dfx_pca.explained_variance_ratio_))],fontsize=15)
plt.yticks(fontsize=15)
plt.ylabel("Explained variance ratio",fontsize=15)
plt.show()
dfx_trans = pca.transform(dfx)
dfx_trans = pd.DataFrame(data=dfx_trans)
dfx_trans.head(10)
plt.figure(figsize=(10,6))
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 54 / 57
lOMoARcPSD|45333583
www.BrainKart.com
plt.scatter(dfx_trans[0],dfx_trans[1],c=df['Class'],edgecolors='k',alpha=0.75,s=150)
plt.grid(True)
plt.title("Class separation using first two principal components\n",fontsize=20)
plt.xlabel("Principal component-1",fontsize=15)
plt.ylabel("Principal component-2",fontsize=15)
plt.show()
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 55 / 57
lOMoARcPSD|45333583
www.BrainKart.com
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 56 / 57
lOMoARcPSD|45333583
www.BrainKart.com
VIVA Questions
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes Page: 57 / 57
Click on Subject/Paper under Semester to enter.
Professional English Discrete Mathematics Environmental Sciences
Professional English - - II - HS3252 - MA3354 and Sustainability -
I - HS3152 GE3451
Digital Principles and
Statistics and Probability and
Computer Organization
Matrices and Calculus Numerical Methods - Statistics - MA3391
- CS3351
- MA3151 MA3251
3rd Semester
1st Semester
4th Semester
2nd Semester
Deep Learning -
AD3501
Embedded Systems
Data and Information Human Values and
and IoT - CS3691
5th Semester
7th Semester
8th Semester
Open Elective-1
Distributed Computing Open Elective 2
- CS3551 Project Work /
Elective-3
Open Elective 3 Intership
Big Data Analytics - Elective-4
CCS334 Open Elective 4
Elective-5
Elective 1 Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering