What is Machine Learning?
Machine learning fits a rule from examples rather than writing every rule by hand.
- Input: measured features, such as SNR and delay spread.
- Target: the answer we want, such as a link-quality class.
- Training: adjust the model using examples with known outcomes.
A classic definition from Tom Mitchell says a program learns from experience if its performance at a task improves with experience. In practical terms:
-
Task: What do we want the system to do? Example: detect spam email.
-
Experience: What data does it learn from? Example: old emails with spam/not-spam labels.
-
Performance: How do we measure success? Example: accuracy, precision, recall, or error rate.
-
Model: a function with adjustable parameters.
-
Training fit: fewer mistakes on known examples.
-
Generalization: reliable answers on new examples, not memorization.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
The Basic Vocabulary
Before studying algorithms, these terms make the field much easier to read:
- Dataset: A collection of examples.
- Sample or instance: One row/example in the dataset.
- Feature: An input variable used by the model. In a house-price model, features could be area, number of rooms, and location.
- Label or target: The answer we want to predict.
- Model: The learned mapping from features to outputs.
- Training set: Data used to fit the model.
- Validation set: Data used to tune choices such as hyperparameters.
- Test set: Data kept aside until the end to estimate real performance.
- Generalization: The ability to work well on new data, not only memorized training data.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Learning as Pattern Finding
Suppose we want to detect whether an email is spam. A hand-written rule system might say: "if the email contains 'free money', mark it as spam." That rule fails quickly because real emails are messy. ML learns from many examples instead:
- It sees features such as words, sender behavior, links, and punctuation.
- It compares its prediction with the correct label.
- It changes its parameters to reduce future mistakes.
- It is evaluated on unseen emails.
This is why data quality matters. A powerful algorithm trained on biased, noisy, or unrepresentative data will still learn the wrong thing.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
What is Classification?
Classification is a supervised ML task where the output is a category. The model asks: "Which class does this input belong to?"
Examples:
- Email filtering: spam or inbox.
- Medical screening: healthy, suspicious, or high-risk.
- Modulation recognition: BPSK, QPSK, 16-QAM, or OFDM.
- Sentiment analysis: positive, neutral, or negative.
The important point is that the output is discrete. If the output is a number such as temperature, price, or channel gain, that is regression rather than classification.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Types of Classification
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Binary Classification
There are only two possible classes.
Examples:
- Fraud or not fraud.
- Link blocked or link accepted.
- Tumor or normal tissue.
The model often outputs a probability first, such as 0.87. A threshold then converts that probability into a final class. If the threshold is 0.5, probability above 0.5 becomes class 1.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Multi-Class Classification
There are more than two classes, but each example belongs to exactly one class.
Examples:
- A handwritten digit is one of 0, 1, 2, ..., 9.
- A modulation scheme is one of BPSK, QPSK, 8-PSK, 16-QAM, or 64-QAM.
- A document is one of sports, politics, business, or science.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Multi-Label Classification
One example can have multiple labels at the same time.
Examples:
- A paper can be tagged as "machine learning", "wireless communication", and "optimization".
- A scene image can contain "car", "person", "road", and "building".
- A medical report can mention several conditions at once.
One output or many? Softmax versus independent sigmoids
1. Formula and symbols
- : Raw score (logit) the model gives class k
- : Number of classes (here 3)
- : Softmax probability: classes compete, the shares sum to 1
- : Independent sigmoid probability: each label is its own yes/no question
- : Predicted class (multi-class) or set of labels (multi-label)
Binary classification is the K = 2 case; one sigmoid output is enough.
2. Work with the current inputs
3. Result
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
How a Classification Model Makes a Decision
Most classifiers learn a decision boundary. This boundary separates one class from another in feature space.
- Two-feature picture: put SNR on one axis and delay spread on the other.
- Decision boundary: a learned line or curve separates "good link" from "bad link" examples.
- Real data: may need many more feature dimensions.
Good classifiers do not simply memorize points. They learn boundaries that are stable enough to handle new observations.
References for this section3
- Scikit-learn documentation, "Supervised learning".
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Evaluation: Accuracy is Not Always Enough
Accuracy means the fraction of predictions that are correct. It is useful, but it can be misleading when classes are imbalanced.
Example: If only 1 percent of emails are spam, a model that always predicts "not spam" gets 99 percent accuracy while being useless for spam detection.
Better metrics:
- Precision: Out of the items predicted positive, how many were actually positive?
- Recall: Out of the actual positive items, how many did the model find?
- F1-score: A balance between precision and recall.
- Confusion matrix: A table showing correct and incorrect predictions per class.
- ROC-AUC: Measures how well a model ranks positives above negatives across thresholds.
- TP/TN: true positive/true negative, correct positive/negative decisions.
- FP/FN: false positive/false negative, wrong positive/negative decisions.
- Accuracy: correct decisions divided by all decisions.
- Precision/Recall: correctness of positive predictions / coverage of actual positives.
- F1: harmonic mean of precision and recall; defined when its denominator is nonzero.
Does changing the threshold improve every classification metric?
1. Formula and symbols
- : supplied positive score
- : threshold
- : True positives: correctly predicted positive examples
- : True negatives: correctly predicted negative examples
- : False positives: negative examples predicted positive
- : False negatives: positive examples predicted negative
Precision needs at least one predicted positive
recall needs at least one actual positive.
2. Work with the current inputs
3. Result
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Common Classification Algorithms
- Logistic Regression: Fast, interpretable, and strong as a baseline.
- K-Nearest Neighbors: Simple and intuitive, but slow for large datasets.
- Decision Tree: Easy to explain, but can overfit.
- Support Vector Machine: Strong for high-dimensional data and margin-based separation.
- Random Forest: Many decision trees combined to reduce overfitting.
- Gradient Boosting and XGBoost: Sequential tree ensembles that often perform very well on tabular data.
- Neural Networks: Powerful for images, speech, text, and large complex datasets.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
A Minimal Python Classification Workflow
Most scikit-learn classifiers follow the same pattern: import the model, create it, fit it, predict, and evaluate it. The code below uses the built-in Iris dataset so it runs without downloading anything.
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, classification_report
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)
model = make_pipeline(
StandardScaler(),
LogisticRegression(max_iter=1000)
)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:", accuracy_score(y_test, y_pred))
print(classification_report(y_test, y_pred))
The important idea is that the preprocessing and model are kept together in a Pipeline. That prevents mistakes where the training data is scaled differently from the test data.
References for this section3
- Scikit-learn documentation, "Supervised learning".
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Common Beginner Mistakes
- Training and testing on the same data.
- Forgetting to scale features for algorithms such as KNN, SVM, and neural networks.
- Using accuracy only on imbalanced datasets.
- Making the model too complex for the amount of data.
- Ignoring data leakage, where information from the test set accidentally enters training.
- Thinking that a higher training score always means a better model.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Takeaway
- Classification output: a category, not a continuous number.
- Success criterion: evaluate on unseen test data, not training memorization.
Continue with Learning Paradigms to build on this note.
References for this section3
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
Check your understanding
0 of 4 answered
Out of 100 examples, 90 predictions are correct. What is accuracy?
There are 8 true positives and 2 false positives. What is precision?
A detector finds 6 of 10 actual positives. What is recall?
Which dataset should remain untouched while selecting thresholds?
Complete references and further reading
- T. M. Mitchell, Machine Learning, McGraw-Hill, 1997.
- C. M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
- Scikit-learn documentation, "Supervised learning".
- Tpoint Tech/Javatpoint, "Classification Algorithm in Machine Learning".