Which kernel is commonly used in non-linear SVM?
Anonymous Quiz
23%
A) Binary kernel
29%
B) Matrix kernel
45%
C) RBF kernel
3%
D) Table kernel
β€1π1
What are Support Vectors?
Anonymous Quiz
8%
A) Random points
25%
B) Farthest points from boundary
58%
C) Closest points to boundary
10%
D) Cluster centers
β€1
What is the decision boundary in SVM called?
Anonymous Quiz
15%
A) Margin
61%
B) Hyperplane
21%
C) Kernel
4%
D) Cluster
π2π’1
β
Clustering with K-Means Algorithm ππ€
π K-Means is one of the most popular unsupervised learning algorithms. It groups similar data points into clusters.
πΉ 1. What is Clustering?
Clustering = Grouping similar data together
π No labels are provided. The algorithm finds hidden patterns automatically.
Examples:
β Customer segmentation
β Grouping similar products
β Image compression
π₯ 2. What is K-Means?
K-Means divides data into K clusters.
π Each cluster has a center called Centroid.
πΉ 3. How K-Means Works
Step-by-step:
1οΈβ£ Choose number of clusters (K)
2οΈβ£ Select random centroids
3οΈβ£ Assign points to nearest centroid
4οΈβ£ Update centroid positions
5οΈβ£ Repeat until stable
πΉ 4. Example
π Customer Segmentation
Customers are grouped based on:
β Age
β Income
β Spending habits
πΉ 5. Implementation (Python)
πΉ 6. Important Terms β
β Cluster β Group of similar points
β Centroid β Center of cluster
β K β Number of clusters
πΉ 7. Choosing Best K (Elbow Method) β
π Elbow Method helps find optimal K.
The graph looks like an elbow π»
πΉ 8. Advantages
β Simple and fast
β Works well for grouped data
β Easy to implement
πΉ 9. Disadvantages
β Need to choose K manually
β Sensitive to outliers
β Not good for irregular shapes
πΉ 10. Why K-Means is Important?
β Used in recommendation systems
β Customer segmentation
β Market analysis
π― Todayβs Goal
β Understand clustering
β Learn centroids & clusters
β Implement K-Means
π K-Means = Finding hidden groups in data π₯
π¬ Tap β€οΈ for more!
π K-Means is one of the most popular unsupervised learning algorithms. It groups similar data points into clusters.
πΉ 1. What is Clustering?
Clustering = Grouping similar data together
π No labels are provided. The algorithm finds hidden patterns automatically.
Examples:
β Customer segmentation
β Grouping similar products
β Image compression
π₯ 2. What is K-Means?
K-Means divides data into K clusters.
π Each cluster has a center called Centroid.
πΉ 3. How K-Means Works
Step-by-step:
1οΈβ£ Choose number of clusters (K)
2οΈβ£ Select random centroids
3οΈβ£ Assign points to nearest centroid
4οΈβ£ Update centroid positions
5οΈβ£ Repeat until stable
πΉ 4. Example
π Customer Segmentation
Customers are grouped based on:
β Age
β Income
β Spending habits
πΉ 5. Implementation (Python)
from sklearn.cluster import KMeans
# Sample data
X = [[1], [2], [10], [11]]
model = KMeans(n_clusters=2)
model.fit(X)
print(model.labels_)
πΉ 6. Important Terms β
β Cluster β Group of similar points
β Centroid β Center of cluster
β K β Number of clusters
πΉ 7. Choosing Best K (Elbow Method) β
π Elbow Method helps find optimal K.
The graph looks like an elbow π»
πΉ 8. Advantages
β Simple and fast
β Works well for grouped data
β Easy to implement
πΉ 9. Disadvantages
β Need to choose K manually
β Sensitive to outliers
β Not good for irregular shapes
πΉ 10. Why K-Means is Important?
β Used in recommendation systems
β Customer segmentation
β Market analysis
π― Todayβs Goal
β Understand clustering
β Learn centroids & clusters
β Implement K-Means
π K-Means = Finding hidden groups in data π₯
π¬ Tap β€οΈ for more!
β€14π2π₯1
K-Means belongs to which type of Machine Learning?
Anonymous Quiz
27%
A) Supervised Learning
10%
B) Reinforcement Learning
59%
C) Unsupervised Learning
4%
D) Deep Learning
β€3
What does the βKβ in K-Means represent?
Anonymous Quiz
9%
A) Number of features
81%
B) Number of clusters
5%
C) Number of rows
5%
D) Number of algorithms
β€4π1
What is the center of a cluster called?
Anonymous Quiz
5%
A) Margin
17%
B) Hyperplane
74%
C) Centroid
5%
D) Vector
β€2π1
Which method is commonly used to find the best value of K?
Anonymous Quiz
7%
A) Pie Method
9%
B) Bar Method
55%
C) Elbow Method
28%
D) Scatter Method
β€3π₯1
Which of the following is a real-world application of K-Means?
Anonymous Quiz
79%
A) Customer segmentation
13%
B) Sorting files
4%
C) Writing code
4%
D) Database backup
β€2π₯1π€1π’1
β
PCA (Principal Component Analysis) Basics ππ€
π PCA is a Dimensionality Reduction technique used to simplify large datasets while keeping important information.
πΉ 1. What is Dimensionality Reduction?
π Reducing the number of features columns in data.
Example:
Instead of 100 features β reduce to 10 important features.
β Faster training
β Better visualization
β Reduced complexity
π₯ 2. What is PCA?
PCA = Principal Component Analysis
π It transforms data into new components called:
β Principal Components
These components capture the maximum variance in data.
πΉ 3. Why PCA is Important?
β Reduces high-dimensional data
β Improves model performance
β Helps avoid overfitting
β Useful for visualization
πΉ 4. How PCA Works (Simple Idea)
1οΈβ£ Find directions with maximum variance
2οΈβ£ Create principal components
3οΈβ£ Keep most important components
4οΈβ£ Remove less useful information
πΉ 5. Example
π Suppose dataset has:
β’ Height
β’ Weight
β’ BMI
β’ Body Fat
Many features may contain similar information.
PCA combines them into fewer components.
πΉ 6. Important Terms β
β Variance β Spread of data
β Principal Component β New feature
β Explained Variance β Information retained
πΉ 7. Implementation (Python)
πΉ 8. Advantages
β Faster ML models
β Reduces noise
β Better visualization
πΉ 9. Disadvantages
β Hard to interpret transformed features
β Possible information loss
πΉ 10. Real-World Uses
β Image compression
β Face recognition
β Big data preprocessing
π― Todayβs Goal
β Understand dimensionality reduction
β Learn principal components
β Understand variance concept
π PCA = Compressing data intelligently π₯
π¬ Tap β€οΈ for more!
π PCA is a Dimensionality Reduction technique used to simplify large datasets while keeping important information.
πΉ 1. What is Dimensionality Reduction?
π Reducing the number of features columns in data.
Example:
Instead of 100 features β reduce to 10 important features.
β Faster training
β Better visualization
β Reduced complexity
π₯ 2. What is PCA?
PCA = Principal Component Analysis
π It transforms data into new components called:
β Principal Components
These components capture the maximum variance in data.
πΉ 3. Why PCA is Important?
β Reduces high-dimensional data
β Improves model performance
β Helps avoid overfitting
β Useful for visualization
πΉ 4. How PCA Works (Simple Idea)
1οΈβ£ Find directions with maximum variance
2οΈβ£ Create principal components
3οΈβ£ Keep most important components
4οΈβ£ Remove less useful information
πΉ 5. Example
π Suppose dataset has:
β’ Height
β’ Weight
β’ BMI
β’ Body Fat
Many features may contain similar information.
PCA combines them into fewer components.
πΉ 6. Important Terms β
β Variance β Spread of data
β Principal Component β New feature
β Explained Variance β Information retained
πΉ 7. Implementation (Python)
from sklearn.decomposition import PCA
import numpy as np
X = np.array([
[1,2],
[3,4],
[5,6]
])
pca = PCA(n_components=1)
X_pca = pca.fit_transform(X)
print(X_pca)
πΉ 8. Advantages
β Faster ML models
β Reduces noise
β Better visualization
πΉ 9. Disadvantages
β Hard to interpret transformed features
β Possible information loss
πΉ 10. Real-World Uses
β Image compression
β Face recognition
β Big data preprocessing
π― Todayβs Goal
β Understand dimensionality reduction
β Learn principal components
β Understand variance concept
π PCA = Compressing data intelligently π₯
π¬ Tap β€οΈ for more!
β€15π€©1
What does PCA stand for?
Anonymous Quiz
7%
A) Primary Component Analysis
75%
B) Principal Component Analysis
14%
C) Predictive Cluster Algorithm
4%
D) Principal Cluster Analysis
β€1
What is the main purpose of PCA?
Anonymous Quiz
9%
A) Data visualization only
14%
B) Classification
73%
C) Dimensionality reduction
3%
D) Data cleaning
β€3
PCA mainly tries to preserve:
Anonymous Quiz
14%
A) Noise
14%
B) Duplicate values
66%
C) Maximum variance
6%
D) Missing values
β€1π1
What are the new transformed features in PCA called?
Anonymous Quiz
10%
A) Clusters
74%
B) Principal Components
12%
C) Hyperplanes
4%
D) Labels
β€2π₯1
Which library module is commonly used for PCA in Python?
Anonymous Quiz
60%
A) sklearn.decomposition
26%
B) sklearn.cluster
8%
C) sklearn.tree
7%
D) numpy.random
β€5π€©1
β
Model Evaluation Metrics ππ€
π After building a Machine Learning model, we must check:
βHow good is the model?β
This is done using evaluation metrics.
πΉ 1. Why Model Evaluation is Important?
β Measures model performance
β Detects errors
β Helps compare models
β Prevents bad predictions
π₯ 2. Evaluation Metrics for Regression
Used for predicting numbers
β MAE (Mean Absolute Error)
π Average absolute error.
MAE = (1/n) Ξ£ |y - yΜ|
β Lower MAE = Better model
β MSE (Mean Squared Error)
π Squares the errors.
MSE = (1/n) Ξ£ (y - yΜ)^2
β Punishes large errors more.
β RMSE (Root Mean Squared Error)
RMSE = βMSE = β[(1/n) Ξ£ (y - yΜ)^2]
β Easy to interpret.
β RΒ² Score β
Measures how well model explains data.
RΒ² = 1 - [Ξ£(y - yΜ)^2 / Ξ£(y - Θ³)^2]
RΒ² = 1 β Perfect model
β Higher RΒ² = Better performance
Where yΜ = predicted value, Θ³ = mean of actual values
π₯ 3. Evaluation Metrics for Classification
Used for categories
β Accuracy
Accuracy = Correct Predictions / Total Predictions
β Precision
π Out of predicted positives, how many are correct?
Precision = TP / (TP + FP)
β Recall
π Out of actual positives, how many detected?
Recall = TP / (TP + FN)
β F1-Score β
Balance between precision & recall.
F1-Score = 2 (Precision Γ Recall) / (Precision + Recall)
πΉ 4. Confusion Matrix β
A table showing prediction results.
Actual Positive & Predicted Positive = TP (True Positive)
Actual Positive & Predicted Negative = FN (False Negative)
Actual Negative & Predicted Positive = FP (False Positive)
Actual Negative & Predicted Negative = TN (True Negative)
TP = model correctly predicted positive
TN = model correctly predicted negative
FP = model wrongly predicted positive
FN = model wrongly predicted negative
πΉ 5. Implementation (Python)
πΉ 6. Why Metrics Matter?
β Helps improve models
β Used in interviews
β Critical in real-world AI systems
π― Todayβs Goal
β Understand regression metrics
β Learn classification metrics
β Understand confusion matrix
π¬ Tap β€οΈ for more!
π After building a Machine Learning model, we must check:
βHow good is the model?β
This is done using evaluation metrics.
πΉ 1. Why Model Evaluation is Important?
β Measures model performance
β Detects errors
β Helps compare models
β Prevents bad predictions
π₯ 2. Evaluation Metrics for Regression
Used for predicting numbers
β MAE (Mean Absolute Error)
π Average absolute error.
MAE = (1/n) Ξ£ |y - yΜ|
β Lower MAE = Better model
β MSE (Mean Squared Error)
π Squares the errors.
MSE = (1/n) Ξ£ (y - yΜ)^2
β Punishes large errors more.
β RMSE (Root Mean Squared Error)
RMSE = βMSE = β[(1/n) Ξ£ (y - yΜ)^2]
β Easy to interpret.
β RΒ² Score β
Measures how well model explains data.
RΒ² = 1 - [Ξ£(y - yΜ)^2 / Ξ£(y - Θ³)^2]
RΒ² = 1 β Perfect model
β Higher RΒ² = Better performance
Where yΜ = predicted value, Θ³ = mean of actual values
π₯ 3. Evaluation Metrics for Classification
Used for categories
β Accuracy
Accuracy = Correct Predictions / Total Predictions
β Precision
π Out of predicted positives, how many are correct?
Precision = TP / (TP + FP)
β Recall
π Out of actual positives, how many detected?
Recall = TP / (TP + FN)
β F1-Score β
Balance between precision & recall.
F1-Score = 2 (Precision Γ Recall) / (Precision + Recall)
πΉ 4. Confusion Matrix β
A table showing prediction results.
Actual Positive & Predicted Positive = TP (True Positive)
Actual Positive & Predicted Negative = FN (False Negative)
Actual Negative & Predicted Positive = FP (False Positive)
Actual Negative & Predicted Negative = TN (True Negative)
TP = model correctly predicted positive
TN = model correctly predicted negative
FP = model wrongly predicted positive
FN = model wrongly predicted negative
πΉ 5. Implementation (Python)
from sklearn.metrics import accuracy_score
y_true = [0, 1, 1, 0]
y_pred = [0, 1, 0, 0]
print(accuracy_score(y_true, y_pred))
πΉ 6. Why Metrics Matter?
β Helps improve models
β Used in interviews
β Critical in real-world AI systems
π― Todayβs Goal
β Understand regression metrics
β Learn classification metrics
β Understand confusion matrix
π¬ Tap β€οΈ for more!
β€16π2
Which metric is commonly used for classification problems?
Anonymous Quiz
24%
A) RMSE
20%
B) MAE
49%
C) Accuracy
7%
D) Variance
β€2
What does MAE stand for?
Anonymous Quiz
74%
A) Mean Absolute Error
9%
B) Maximum Absolute Error
12%
C) Mean Average Evaluation
5%
D) Model Accuracy Error
β€5
In a good regression model, the RΒ² score should be:
Anonymous Quiz
26%
A) Close to 0
7%
B) Negative
64%
C) Close to 1
3%
D) Equal to 100
β€5π1
Which metric balances Precision and Recall?
Anonymous Quiz
17%
A) Accuracy
11%
B) RMSE
70%
C) F1-Score
3%
D) MAE
β€4π1