1. Definition
Linear Classification is a supervised machine learning technique used to classify data into different classes or categories using a linear decision boundary.
In simple words:
Linear classification draws a straight line (or plane) to separate data into different classes.
For example, suppose we want to classify students as Pass or Fail based on study hours and attendance.
Attendance
↑
|
PASS | ● ● ●
| ● ● ●
| /
| / ← Decision Boundary
| /
FAIL | ○ ○ ○
| ○ ○ ○
+----------------→ Study Hours
The line separates the two classes.
2. What is a Linear Classifier?
A linear classifier makes a decision using a linear equation.
For two features:\[ w_1x_1+w_2x_2+b=0 \]
Where:
- \(x_1, x_2\) = input features
- \(w_1, w_2\) = weights
- \(b\) = bias
- The equation represents the decision boundary.
The classifier decides the class based on which side of the boundary the data point lies.
3. How Linear Classification Works
The basic process is:
Training Data
↓
Input Features
↓
Learn Weights and Bias
↓
Create Decision Boundary
↓
New Data
↓
Calculate Score
↓
Class Prediction
For example:
Study Hours + Attendance
↓
Linear Classifier
↓
Pass / Fail
4. Simple Example
Suppose we have:
| Study Hours | Result |
|---|---|
| 2 | Fail |
| 3 | Fail |
| 5 | Pass |
| 6 | Pass |
| 8 | Pass |
The algorithm learns a boundary such as:\[ x = 4 \]
Therefore:
- Study hours < 4 → Fail
- Study hours ≥ 4 → Pass
This is a simple one-dimensional example of linear classification.
5. Decision Boundary
The most important concept in linear classification is the decision boundary.
A decision boundary is a line or surface that separates different classes.
For two-dimensional data:\[ w_1x_1+w_2x_2+b=0 \] .graphable-function-v2-jsxgraph { position: relative; z-index: 1; width: 100%; height: 100%; overflow: hidden; touch-action: none; background: transparent; } .graphable-function-v2-jsxgraph svg { overflow: hidden; } .graphable-function-v2-jsxgraph svg :focus:not(:focus-visible) { outline: none; } .graphable-function-v2-jsxgraph-inequality-fill { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; } .graphable-function-v2-jsxgraph-explicit-fallback { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; } .graphable-function-v2-jsxgraph-guide { position: absolute; z-index: 2; top: 0; bottom: 0; border-left: 1px dashed var(–border-heavy); pointer-events: none; } .graphable-function-v2-jsxgraph-hover-point { position: absolute; width: 8px; height: 8px; margin-left: -4px; margin-top: -4px; border: 1.5px solid var(–bg-primary); border-radius: 9999px; pointer-events: none; z-index: 2; } .graphable-function-v2-jsxgraph-tooltip { position: absolute; z-index: 3; overflow: visible; pointer-events: none; } .graphable-function-v2-jsxgraph-reset { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; justify-content: center; z-index: 2; width: 32px; height: 32px; border: 1px solid var(–border-light); border-radius: 9999px; background: var(–bg-primary); color: var(–text-primary); box-shadow: 0 2px 8px rgb(0 0 0 / 8%); padding: 0; transition: opacity 160ms ease, transform 160ms ease; } 0,0\(2x+y-4=0,2x+y-4>0,2x+y-4<0\)
For example, one side may represent Class A and the other side Class B.
6. Common Linear Classification Algorithms
Some important algorithms are:
1. Logistic Regression
Despite its name, logistic regression is mainly used for classification.
Example:
Input → Logistic Regression → 0 or 1
Applications:
- Spam / Not Spam
- Pass / Fail
- Disease / No Disease
- Customer buys / Does not buy
2. Perceptron
The Perceptron is one of the simplest linear classification algorithms.
It calculates:\[ z=w_1x_1+w_2x_2+b \]
Then applies a decision rule.
For example:
If z ≥ 0 → Class 1
If z < 0 → Class 0
3. Linear Support Vector Machine
A Linear SVM finds a line or hyperplane that separates classes while trying to maximize the margin between them.
Example:
Class A | Class B
● ● ● | ○ ○ ○
● ● ● | ○ ○ ○
● ● ● | ○ ○ ○
↑
Decision Boundary
7. Linear Classification vs Linear Regression
This is an important exam question.
| Linear Regression | Linear Classification |
|---|---|
| Predicts numerical values | Predicts classes/categories |
| Output is continuous | Output is categorical |
| Example: ₹50,000 salary | Example: High/Low salary |
| Example: house price | Example: Buy/Don’t Buy |
| Fits a line to predict value | Uses boundary to separate classes |
Easy memory:
Regression → Number
Classification → Category
8. Advantages
- Simple to understand
- Easy to implement
- Fast for large datasets
- Requires relatively less computational power.
- Works well when classes are approximately linearly separable.
- Results are often easier to interpret than complex models.
9. Disadvantages
- It does not work well when classes have a non-linear relationship.
- Performance may decrease with complex datasets.
- Outliers can affect some linear models.
- Feature scaling may be important for some algorithms.
- Complex patterns may require non-linear models.
For example:
Linear pattern:
● ● ● | ○ ○ ○
● ● ● | ○ ○ ○
Easy to separate with a straight line.
But:
● ●
● ●
○ ○
○ ○
A simple straight line may not separate the classes properly.
10. Applications
Linear classification is used in:
- Email spam detection
- Customer churn prediction
- Fraud detection
- Medical diagnosis
- Sentiment classification
- Loan approval
- Student pass/fail prediction
- Digital marketing – predicting whether a customer will purchase or not.
11. Exam-Ready Answer
Linear Classification is a supervised machine learning technique used to classify data into different categories using a linear decision boundary. The decision boundary can be represented mathematically as \(w_1x_1+w_2x_2+b=0\). The algorithm learns weights and bias from training data and uses them to classify new data. Common linear classification algorithms include Logistic Regression, Perceptron and Linear SVM. It is useful for problems such as spam detection, pass/fail prediction and customer purchase prediction. Its main advantage is that it is simple and computationally efficient, while its limitation is that it cannot handle complex non-linear patterns effectively.
Remember:
Linear Classification = Features → Straight-line Boundary → Class/Category
