You are on page 1of 1

Write A* Algorithm? Describe about Nearest Neighbor (NN) Rule?

o KNN algorithm at the training phase just stores the dataset and when it
What is an A* Algorithm?
gets new data, then it classifies that data into a category that is much
It is a searching algorithm that is used to find the shortest path between an initial and a
similar to the new data.
final point.
It is a handy algorithm that is often used for map traversal to find the shortest path to
be taken. A* was initially designed as a graph traversal problem, to help build a robot
that can find its own course. It still remains a widely popular algorithm for graph
traversal. Define K – means clustering? Describe about Bayes
It searches for shorter paths first, thus making it an optimal and complete algorithm. An
optimal algorithm will find the least cost outcome for a problem, while a complete
Classifier and Support Vector Machine (SVM)?
algorithm finds all the possible outcomes of a problem. What is K-Means Algorithm?
K-Means Clustering is an Unsupervised
Another aspect that makes A* so powerful is the use of weighted graphs in its
implementation. A weighted graph uses numbers to represent the cost of taking each Learning algorithm, which groups the
path or course of action. This means that the algorithms can take the path with the unlabeled dataset into different clusters.
least cost, and find the best route in terms of distance and time. Here K defines the number of pre-
defined clusters that need to be created
Algorithm in the process, as if K=2, there will be
Initial condition - we create two lists - two clusters, and for K=3, there will be
Open List and Closed List. three clusters, and so on.
It is an iterative algorithm that divides the
Now, the following steps need to be
unlabeled dataset into k different clusters in such a way that each dataset belongs only one
implemented -
group that has similar properties.
 The open list must be The below diagram explains the working of the K-means Clustering Algorithm:
initialized. 
Support Vector Machine Algorithm
 Put the starting Support Vector Machine or SVM is one of the most popular Supervised Learning
node on the open list (leave its f at zero). Initialize the closed list.  algorithms, which is used for Classification as well as Regression problems. However,
 Follow the steps until the open list is non-empty: primarily, it is used for Classification
problems in Machine Learning.
1. Find the node with the least f on the open list and name it “q”.
The goal of the SVM algorithm is to
2. Remove Q from the open list.
create the best line or decision
3. Produce q's eight descendants and set q as their parent.
boundary that can segregate n-
4. For every descendant:
dimensional space into classes so
i) If finding a successor is the goal, cease looking
that we can easily put the new data
ii)Else, calculate g and h for the successor.
successor.g = q.g + the calculated distance between the successor and the q. point in the correct category in the
successor.h = the calculated distance between the successor and the goal. We will future. This best decision boundary
cover three heuristics to do this: the Diagonal, the Euclidean, and the Manhattan is called a hyperplane.
heuristics. SVM chooses the extreme
successor.f = successor.g plus successor.h points/vectors that help in creating
iii) Skip this successor if a node in the OPEN list with the same location as it but a lower the hyperplane. These extreme cases are called as support vectors, and hence algorithm
f value than the successor is present. is termed as Support Vector Machine. Consider the below diagram in which there are
iv) Skip the successor if there is a node in the CLOSED list with the same position as the two different categories that are classified using a decision boundary or hyperplane:
Types of SVM
successor but a lower f value; otherwise, add the node to the open list end (for loop).
SVM can be of two types:
 Push Q into the closed list and end the while loop. o Linear SVM: Linear SVM is used for linearly separable data, which means
K-Nearest Neighbor(KNN) Algorithm for Machine Learning
if a dataset can be classified into two classes by using a single straight line,
o K-Nearest Neighbour is one of the simplest Machine Learning algorithms then such data is termed as linearly separable data, and classifier is used
based on Supervised Learning technique. called as Linear SVM classifier.
o K-NN algorithm assumes the similarity between the new case/data and o Non-linear SVM: Non-Linear SVM is used for non-linearly separated data,
available cases and put the new case into the category that is most similar which means if a dataset cannot be classified by using a straight line, then
to the available categories. such data is termed as non-linear data and classifier used is called as Non-
o K-NN algorithm stores all the available data and classifies a new data linear SVM classifier.
point based on the similarity. This means when new data appears then it
can be easily classified into a well suite category by using K- NN
algorithm.
o K-NN algorithm can be used for Regression as well as for Classification
but mostly it is used for the Classification problems.
o K-NN is a non-parametric algorithm, which means it does not make any
assumption on underlying data.
o It is also called a lazy learner algorithm because it does not learn from
the training set immediately instead it stores the dataset and at the time
of classification, it performs an action on the dataset.

You might also like