Unit 5 Data
Unit 5 Data
types of machine learning. There are several core types of machine learning, and each serves
different purposes based on the nature of the data and the task. Here are the key types:
1. Supervised Learning
Definition: In supervised learning, the algorithm is trained on labeled data, meaning the
input comes with a known output. The model learns the mapping from inputs to outputs
during training.
Examples:
2. Unsupervised Learning
Definition: In unsupervised learning, the algorithm is given unlabeled data. The model tries
to find hidden patterns or groupings in the data.
Goal: Discover structure or relationships in the data without specific output labels.
Examples:
3. Semi-supervised Learning
Definition: This type combines a small amount of labeled data with a large amount of
unlabeled data. The goal is to improve learning efficiency when labeling data is expensive or
time-consuming.
Goal: Leverage both labeled and unlabeled data to improve model performance.
Use Cases: Medical image analysis, facial recognition, and speech processing.
Definition: In RL, an agent learns to make decisions by interacting with an environment. The
agent performs actions and receives rewards or penalties based on those actions, aiming to
maximize cumulative rewards over time.
Unit 5
Goal: To learn a policy that maximizes rewards through trial and error.
Examples:
o Game playing: AI systems playing video games or board games (e.g., AlphaGo).
Use Cases: Robotics, autonomous driving, game AI, and industrial automation.
5. Self-supervised Learning
Definition: A type of unsupervised learning where the model generates its own labels from
the input data. The model learns by predicting part of the input from other parts of the input
data.
Examples: Predicting the next word in a sentence (used in NLP models like GPT).
Few-shot learning: The model learns from only a small number of labeled examples.
Zero-shot learning: The model is able to perform tasks it wasn’t specifically trained for by
using knowledge learned from other tasks.
Use Cases: Image classification with minimal data, language translation without parallel data.
Each type of machine learning is suited to different kinds of data and problems, and they often
complement each other in advanced systems.
1. Automation of Repetitive Tasks: Machine learning can automate repetitive tasks, saving
time and reducing human error.
2. Improved Decision-Making: ML algorithms can analyze large amounts of data and provide
insights that aid in better decision-making.
4. Scalability: Machine learning models can handle large volumes of data and continue to
improve as more data becomes available.
5. Predictive Power: ML models can predict future outcomes (e.g., sales forecasting, stock
market trends) based on past data.
6. Handling Complex Problems: Machine learning can solve complex problems that are difficult
for traditional programming methods (e.g., image recognition, natural language processing).
4. Autonomous Vehicles: Self-driving cars use ML for image processing, decision-making, and
navigation.
1. Regression:
o Ridge and Lasso Regression: Variations of linear regression that use regularization to
prevent overfitting.
o Support Vector Regression (SVR): Uses the principles of support vector machines to
predict continuous values.
Use Cases:
2. Classification:
o Decision Trees: Split data into branches based on feature values to classify into
categories.
Unit 5
o K-Nearest Neighbors (KNN): Classifies a data point based on how its neighbors are
classified.
o Support Vector Machines (SVM): Classifies data by finding a hyperplane that best
separates the different classes.
o Naive Bayes: Based on Bayes' theorem, often used for text classification.
Use Cases:
Unsupervised learning refers to algorithms that are trained on data without labeled responses. The
goal of unsupervised learning is to find hidden structures in data. Clustering is one of the most
popular techniques in unsupervised learning, where the algorithm groups similar data points
together based on some similarity measure.
Types of Clustering
1. K-means Clustering
o Pros: Simple and efficient, works well with large datasets, scales well with the
number of features.
o Cons: Sensitive to initial placement of centroids, does not work well with non-
spherical clusters or varying cluster sizes.
2. Hierarchical Clustering
o Overview: DBSCAN identifies clusters based on the density of data points, and can
handle clusters of arbitrary shapes. It also identifies outliers (noise) that do not
belong to any cluster.
o Pros: No need to specify the number of clusters, can find clusters of arbitrary shapes,
good at handling noise.
o Cons: Performance can degrade with high-dimensional data, sensitive to the choice
of parameters (e.g., epsilon and min_samples).
o Pros: Can model more complex cluster shapes than K-means, provides a probabilistic
approach (soft clustering).
5. Affinity Propagation
o Pros: Does not require the number of clusters to be predefined, can work well with
non-convex clusters.
o Cons: Computationally expensive for large datasets, may not scale well.
6. Spectral Clustering
Reinforcement learning is a type of machine learning where an agent learns to make decisions by
performing actions in an environment and receiving feedback in the form of rewards or penalties.
The goal is to maximize the cumulative reward over time.
Agent: The learner or decision maker that interacts with the environment.
Environment: The external system the agent interacts with (e.g., a game or robot).
Action: The choices the agent makes to interact with the environment.
Unit 5
Reward: A scalar value given as feedback after an action is performed, guiding the agent's
learning.
Policy: A strategy that the agent uses to decide what action to take in each state.
Value Function: A function that estimates how good a given state or action is in terms of
future rewards.
Q-learning: A model-free reinforcement learning algorithm that learns the value of action-
state pairs, without needing a model of the environment.
In reinforcement learning, prediction comes in the form of estimating the future rewards or the
future state of the environment. The agent uses this information to improve its policy to make better
decisions.
Overfitting occurs when a model learns not only the underlying patterns in the training data but also
the noise and random fluctuations. As a result, the model performs well on the training data but
poorly on unseen test data, as it fails to generalize.
Causes of Overfitting:
1. Complex Models: Models with too many parameters (e.g., deep neural networks) may fit the
training data very closely, capturing even the noise.
2. Insufficient Training Data: With too little data, the model may memorize the data rather
than learning generalizable patterns.
3. Excessive Training Time: Training a model for too many epochs may lead it to start
memorizing the training data instead of learning useful patterns.
Indicators of Overfitting:
High accuracy on training data but poor accuracy on test or validation data.
Complexity of the model: Very large or complex models tend to overfit more easily.
Solutions to Overfitting:
3. Pruning: For decision trees, pruning can remove nodes that add little value to the model.
4. Ensemble Methods: Combine multiple models (e.g., Random Forest, Gradient Boosting) to
reduce the variance and improve generalization.
5. Early Stopping: Stop training when the model starts to show signs of overfitting (i.e., when
the test error starts to increase).
Unit 5
6. More Training Data: Increasing the amount of data can help the model generalize better.
7. Dropout (for Neural Networks): In deep learning, dropout randomly disables a fraction of
the neurons during training to prevent the model from relying too heavily on any single
feature.
By using these techniques, overfitting can be mitigated, helping the model to generalize well on new,
unseen data.