MLP U2
MLP U2
LEARNING
WITH PYTHON
SEMESTER 5
UNIT - 2
HI COLLEGE
SYLLABUS
UNIT - 2
HI COLLEGE
SUPERVISED LEARNING ALGORITHMS:
Supervised learning algorithms are a type of machine learning technique that
use labeled data to train a model to make predictions or decisions for new,
unseen data. Here are some examples of commonly used supervised learning
algorithms:
The margin is the distance between the hyperplane and the closest data points,
called support vectors. By maximizing the margin, SVMs can achieve better
generalization performance and reduce overfitting.
SVMs can also handle non-linear decision boundaries by mapping the input
data into a higher-dimensional space using a kernel function, such as a
polynomial, radial basis function (RBF), or sigmoid function. This allows SVMs to
separate complex, non-linear decision boundaries.
In classification tasks, SVMs output a label for each new input data point based
on which side of the hyperplane it falls on. In regression tasks, SVMs output a
continuous value based on which side of the hyperplane the input data point
falls on.
SVMs have several advantages over other supervised learning algorithms, such
as their ability to handle high-dimensional input spaces, their robustness to
outliers and noise, and their ability to provide interpretable decision
boundaries. However, SVMs can be computationally expensive for large
datasets due to their optimization requirements.
K-NEAREST NEIGHBOUR
Imagine you're lost in a forest and need to find your way to a specific tree. You
wouldn't draw a map, right? Instead, you'd look around and ask nearby trees
which way to go.
k-Nearest Neighbours (k-NN) is like that! It's a simple way to make predictions
in machine learning. Here's how:
Example:
Imagine you want to classify fruits as apples or oranges. You have a basket of
fruits with features like size and color. When you encounter a new fruit, k-NN
would:
* Find the 3 closest fruits (k=3) in the basket based on size and color.
* If 2 are apples and 1 is an orange, the new fruit is likely an apple!
k-NN is simple, but powerful for many tasks like image recognition and
recommendation systems. It's like asking your friends for advice when you're
unsure just in a more mathematical way.
Instead of relying on one detective, you gather a whole team (the forest).
Each detective builds their own "case file" (decision tree) based on a random
subset of features and data points from the investigation. This diversity
prevents any one detective from getting stuck on irrelevant details.
When you encounter a new "suspect" (data point), each detective examines
it through their unique lens, asking different questions and analyzing
different clues (features).
No single detective has all the answers, so they share their findings. Each
tree makes a prediction (e.g., guilty or innocent) based on its own analysis.
The final verdict? The majority vote wins! The most common prediction from
the forest becomes the overall prediction for the new data point.
- Accuracy Boost:By combining diverse perspectives, the forest reduces the risk
of overfitting and improves overall accuracy compared to single decision trees.
- Robustness:Even if some detectives make mistakes, the majority vote can still
lead to a correct conclusion.
- Versatility: The forest can handle various tasks, including classification (e.g.,
spam vs. not spam) and regression (e.g., predicting house prices).