Introduction to learning, hypothesis space and evaluation notes — Unit 1
Free unit-wise study notes on introduction to learning, hypothesis space and evaluation for Machine Learning Techniques, Semester 6 of B.Tech — Computer Science & Engineering — key concepts, examples, important questions and a revision checklist for semester exams.
Introduction to learning, hypothesis space and evaluation
Notebook — 8 pages
Page 1
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
1. What is Machine Learning?
Machine Learning (ML) is a subset of Artificial Intelligence that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.
⇒1.1 Tom Mitchell's Formal Definition
A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.
Example: Spam Filter
Task (T): Classifying emails as spam or not spam.
Experience (E): Observing a dataset of emails already labeled by users.
Performance (P): The percentage of new emails correctly classified.
Page 2
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
2. Types of Machine Learning
⇒2.1 Supervised Learning
The model is trained on a labeled dataset (data where the 'answer' is provided). The algorithm learns the mapping from inputs (X) to outputs (Y). Example: Predicting house prices based on historical sales.
⇒2.2 Unsupervised Learning
The model is provided with data that has no labels. The algorithm must find hidden patterns or groupings in the data itself. Example: Segmenting customers into groups based on purchasing behavior.
⇒2.3 Reinforcement Learning
An agent learns to make decisions by performing actions in an environment and receiving rewards or penalties. Example: Training a computer to play chess or autonomous driving.
Page 3
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
3. Hypothesis Space
When a machine learning algorithm is training, it is essentially searching for a mathematical function that best fits the data.
⇒3.1 What is a Hypothesis?
A hypothesis (h) is a single, specific mathematical function that maps inputs to outputs. For example, `y = 2x + 1` is one hypothesis.
⇒3.2 The Hypothesis Space (H)
The hypothesis space `H` is the set of all possible hypotheses that the algorithm is allowed to consider. The goal of the ML algorithm is to search through `H` to find the hypothesis that minimizes the error on the training data.
Page 4
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
4. Inductive Bias
If an algorithm is perfectly unbiased, it cannot generalize to data it has never seen before. It will only memorize the training data.
⇒4.1 What is Inductive Bias?
The set of assumptions that the learning algorithm uses to predict outputs given inputs that it has not encountered. Without inductive bias, learning is impossible.
Example: Linear regression has a very strong inductive bias: it assumes that the relationship between the inputs and outputs is a straight line. If the true relationship is a curve, linear regression will fail (Underfitting).
Page 5
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
5. Overfitting and Underfitting
⇒5.1 Underfitting (High Bias)
Occurs when the model is too simple to capture the underlying patterns in the data. (e.g., trying to fit a straight line to a U-shaped scatter plot). It performs poorly on both training and test data.
⇒5.2 Overfitting (High Variance)
Occurs when the model is too complex (too many parameters). It essentially memorizes the noise and random fluctuations in the training data, rather than the true pattern. It performs perfectly on training data, but terribly on new test data.
⇒5.3 The Sweet Spot
The goal is a model complex enough to capture the pattern, but simple enough to generalize. We control this using Regularization (penalizing complex models).
Page 6
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
6. Model Evaluation Strategies
How do we know if our model is any good before deploying it to the real world? We cannot test it on the data it trained on, because of the risk of overfitting.
⇒6.1 Train / Test Split
We randomly divide the dataset into a Training Set (e.g., 80%) and a Testing Set (e.g., 20%). The model learns on the 80%, and is evaluated on the remaining 20% that it has never seen.
⇒6.2 K-Fold Cross Validation
A more robust method. The dataset is divided into `K` equal subsets (folds). The model is trained on `K-1` folds and tested on the remaining fold. This process is repeated `K` times, with each fold serving as the test set exactly once. The final score is the average of all `K` tests.
Page 7
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
7. Evaluation Metrics for Classification
When predicting categories (e.g., Spam/Not Spam, Cancer/No Cancer), simple 'Accuracy' is often misleading. If 99% of emails are Not Spam, a model that blindly guesses 'Not Spam' is 99% accurate, but completely useless.
True Negatives (TN): Predicted Not Spam, actually Not Spam.
False Positives (FP): Predicted Spam, actually Not Spam. (Type I Error).
False Negatives (FN): Predicted Not Spam, actually Spam. (Type II Error).
Page 8
Wink Notes
B.Tech CSE — 6th Semester
Machine Learning Techniques
— Unit - 1 —
8. Precision, Recall, and F1-Score
Precision: `TP / (TP + FP)`. Out of all the emails the model claimed were spam, what percentage actually were? (Crucial when false positives are costly, e.g., sending important emails to the spam folder).
Recall (Sensitivity): `TP / (TP + FN)`. Out of all the actual spam emails in the dataset, what percentage did the model successfully find? (Crucial when false negatives are deadly, e.g., missing a cancer diagnosis).
⇒8.1 The Trade-off
There is always a trade-off between Precision and Recall. To balance them, we use the F1-Score, which is the harmonic mean of the two: `2 (Precision Recall) / (Precision + Recall)`.