AI Logic School

Empowering Students with AI & Computational Thinking

CBSE Class 11 AI Machine Learning Basics 2025-26 | Linear Regression KNN K-Means | Code 843 Unit 6 Notes

CBSE · SUB CODE 843 · CLASS 11 · UNIT 6

📥 Class 11 AI Notes — Unit 6: Machine Learning Basics

Complete notes with Python programs, examples and exam tips for CBSE Code 843 · Free for all students

Class XI | Subject: Artificial Intelligence | Code: 843 | Unit 6: Machine Learning | Session 2025-26
Complete study notes covering all ML types, algorithms, Python programs, daily life examples and exam tips as per the official CBSE Class 11 AI syllabus.

Class 11 AI Code 843 Machine Learning Unit 6 Notes Linear Regression KNN Algorithm K-Means Clustering CBSE 2025-26
CBSE · SUB CODE 843 · CLASS 11 · UNIT 6

Machine Learning Basics

From zero to understanding ML — explained with daily life examples

Supervised Learning Unsupervised Learning Linear Regression kNN · k-Means
WHAT IS MACHINE LEARNING?

Machine Learning (ML) is a branch of AI where machines learn from data and improve over time without being explicitly programmed for every task.

Machine Learning is the core of modern AI applications. When you use Google Search, YouTube recommendations, Netflix suggestions, Gmail spam filter, or face unlock on your phone — all of these use Machine Learning. In CBSE Class 11 AI (Code 843), Unit 6 covers ML fundamentals including types of learning, key algorithms, and Python implementation.

🍎 UNDERSTAND WITH A DAILY LIFE EXAMPLE
👶 HOW A CHILD LEARNS

You show a child 100 pictures of dogs and cats. After seeing enough examples, the child can identify a new dog or cat — even one they have never seen before!

🤖 HOW ML WORKS

You feed 10,000 dog and cat images to a computer. The ML model learns patterns (ears, tail, face) and can now identify any new animal image correctly!

Types of Machine Learning

There are three main types of Machine Learning. Understanding the difference between them is very important for CBSE Class 11 AI board exams. Each type is used for different kinds of problems and data.

TYPE 1
Supervised Learning

The machine is trained on labelled data — data that already has the correct answers. The machine learns by comparing its predictions to the correct answers and adjusting itself to reduce errors.

🏠 DAILY LIFE EXAMPLE — House Price Prediction

You have data of 500 houses — size, location, age → and their actual selling prices. You train a model on this data. Now give it a new house's size and location — it predicts the price! This is supervised learning because you gave it the correct answers (prices) during training.

Other real-world examples of Supervised Learning: Gmail spam filter (spam/not spam), Medical diagnosis (disease/no disease), Credit card fraud detection, Image recognition (cat/dog), Weather forecasting (rain/no rain).

Linear Regression Classification kNN Algorithm Decision Tree Spam Detection
TYPE 2
Unsupervised Learning

The machine is trained on unlabelled data — no correct answers given. The machine finds hidden patterns, groups and structures in the data completely on its own.

🛒 DAILY LIFE EXAMPLE — Amazon Product Recommendations

Amazon groups customers into clusters based on buying behavior — without anyone telling it what the groups are. Customers who buy science books get grouped together. Now Amazon recommends science books to anyone in that group. Nobody labelled the data — the machine found the pattern itself!

Other examples: Grouping news articles by topic, Detecting unusual transactions (anomaly detection), Social media friend suggestions, DNA sequence analysis in biology.

k-Means Clustering Customer Segmentation Anomaly Detection PCA
TYPE 3
Reinforcement Learning

The machine learns by trial and error — getting rewards for correct actions and penalties for wrong ones. Like training a dog with treats — do the right thing, get a reward!

🎮 DAILY LIFE EXAMPLE — Video Games AI

Google's AlphaGo played millions of games against itself. Every time it won, it got a reward. Every time it lost, it learned what NOT to do. After enough games, it became the world's best Go player — beating world champions!

Other examples: Self-driving cars (reward for safe driving), Robot learning to walk, Personalized content feeds, Trading algorithms in stock markets.

Linear Regression — Explained Simply

Linear Regression is a Supervised Learning algorithm used to predict a continuous numerical value. It finds the best straight line through your data points so you can predict future values.

Formula: y = mx + c  |  where y = predicted value, m = slope, x = input, c = intercept

📚 DAILY LIFE EXAMPLE — Study Hours vs Marks

If a student studies 2 hours → gets 50 marks, 4 hours → 65 marks, 6 hours → 80 marks... Linear regression draws a line through these points. Now if you study 7 hours, the model predicts your marks! The formula is: Marks = (slope × Hours) + constant

🐍 Python Code — Linear Regression
import numpy as np
from sklearn.linear_model import LinearRegression

# Study hours and marks data
hours = np.array([[2],[4],[6],[8],[10]])
marks = np.array([50, 65, 75, 85, 95])

# Create and train the model
model = LinearRegression()
model.fit(hours, marks)

# Predict marks for 7 hours of study
predicted = model.predict([[7]])
print(f"Predicted marks for 7 hours: {predicted[0]:.1f}")
Output: Predicted marks for 7 hours: 80.0

k-Nearest Neighbour (kNN) — Explained Simply

kNN is a Supervised Learning algorithm used for classification. It classifies a new data point based on the majority class of its K nearest neighbors in the training data.

Key point: kNN does not build a model — it memorizes the entire training dataset. When a new point arrives, it calculates distance to all training points and picks the K closest ones.

👫 DAILY LIFE EXAMPLE — "Tell me your friends, I'll tell you who you are"

Imagine a new student joins your school. You don't know if they like Science or Arts. kNN says — look at their 3 nearest neighbours (most similar students). If 2 out of 3 similar students like Science, the new student probably likes Science too! That's kNN — classify based on nearest neighbours.

🐍 Python Code — kNN Classifier
from sklearn.neighbors import KNeighborsClassifier
import numpy as np

# Features: [height(cm), weight(kg)] → Sport: 0=Basketball, 1=Gymnastics
X = np.array([[180,75],[175,70],[165,55],[160,50],[170,65]])
y = np.array([0, 0, 1, 1, 0])

# Train kNN with k=3
model = KNeighborsClassifier(n_neighbors=3)
model.fit(X, y)

# Predict for a new student: height=168, weight=58
result = model.predict([[168, 58]])
sports = ["Basketball","Gymnastics"]
print(f"Predicted sport: {sports[result[0]]}")
Output: Predicted sport: Gymnastics

k-Means Clustering — Explained Simply

k-Means is an Unsupervised Learning algorithm used for clustering — grouping similar data points together without any labels. You decide how many groups (K) you want.

How it works: 1. Choose K random points as initial cluster centers (centroids). 2. Assign each data point to the nearest centroid. 3. Recalculate centroids as the average of all points in the cluster. 4. Repeat steps 2-3 until centroids stop moving.

🎂 DAILY LIFE EXAMPLE — Sorting Sweets at a Party

Imagine 20 sweets are scattered on a table — gulab jamun, ladoo, and barfi all mixed up. k-Means (with k=3) will automatically group them into 3 clusters based on their shape, size and color — without you telling it what each sweet is called. It just finds 3 natural groups!

🐍 Python Code — k-Means Clustering
from sklearn.cluster import KMeans
import numpy as np

# Customer data: [age, spending_score]
customers = np.array([
    [25,70],[30,80],[22,65],   # Young high spenders
    [50,20],[55,30],[48,25],   # Older low spenders
    [35,50],[40,55],[38,48]    # Middle group
])

# Group into 3 clusters
model = KMeans(n_clusters=3, random_state=0)
model.fit(customers)

print("Customer groups:", model.labels_)
print("Group centers:", model.cluster_centers_)
Output: Customer groups: [0 0 0 1 1 1 2 2 2]  |  3 clusters found automatically

Quick Comparison — All Three Algorithms

Algorithm ML Type Purpose Output Daily Example
Linear Regression Supervised Predict a number Continuous value Predicting exam marks
kNN Supervised Classify into categories Class label Spam or not spam email
k-Means Unsupervised Group similar items Cluster number Customer segmentation
📊 Supervised vs Unsupervised Learning — Key Differences
Feature Supervised Learning Unsupervised Learning
Data Labelled (with correct answers) Unlabelled (no correct answers)
Goal Predict output for new data Find hidden patterns or groups
Algorithms Linear Regression, kNN, Decision Tree k-Means, PCA, DBSCAN
Example Spam detection, Price prediction Customer grouping, News clustering

Important Viva & Board Exam Questions

Q1. Define Machine Learning. How is it different from traditional programming?
ML is a branch of AI where machines learn from data without being explicitly programmed. In traditional programming, rules are written by humans → computer follows them. In ML, data + output are given → computer finds the rules itself.
Q2. What is the difference between Supervised and Unsupervised Learning?
Supervised: trained on labelled data with correct answers. Example: spam detection. Unsupervised: trained on unlabelled data, finds hidden patterns. Example: customer segmentation.
Q3. What is Linear Regression? Give one real-world application.
Linear Regression finds the best-fit straight line to predict continuous values. Application: predicting house prices based on size and location.
Q4. Explain kNN algorithm with an example.
kNN classifies a new point based on the majority class of its K nearest neighbors. Example: if K=3 and 2 out of 3 nearest emails are spam, the new email is classified as spam.
Q5. What is k-Means Clustering? How is it different from kNN?
k-Means is unsupervised — groups unlabelled data into K clusters. kNN is supervised — classifies labelled data. k-Means finds groups; kNN predicts class labels.
Q6. What is Reinforcement Learning? Give one example.
RL trains an agent through rewards and penalties. Example: AlphaGo — learned to play Go by getting rewards for winning moves and penalties for losing moves.
📝 EXAM TIPS — REMEMBER THESE FOR CBSE CODE 843
  • ML = machines learn from data without being explicitly programmed
  • Supervised = labelled data | Unsupervised = unlabelled data
  • Linear Regression = predict continuous values (marks, price, temperature)
  • kNN = classify into categories (spam/not spam, disease/no disease)
  • k-Means = group data into k clusters (no labels needed)
  • kNN is Supervised; k-Means is Unsupervised — don't confuse them!
  • Pearson Correlation: +1 = strong positive, -1 = strong negative, 0 = no relation
  • Reinforcement Learning uses reward and penalty — no labelled data
🔗 More Free CBSE AI Resources — AI Logic School
📘 CLASS 12
Class 12 AI Practical File
20+ Python programs for CBSE Code 843 with output.
📗 CLASS 9
Class 9 AI Practical File
15 Python programs for CBSE Code 417 with output.
📙 CLASS 10
Class 10 AI Unit 2 Notes
50 MCQs, Case Studies, Q&A for CBSE Code 417.

📲 Get Complete Class 11 AI Notes PDF

Join our Telegram channel for free PDF downloads of all CBSE AI notes, worksheets and practical files.

📲 Join Telegram — Free PDF
AI Logic School · Machine Learning Basics · CBSE Class 11 · Sub Code 843 · Unit 6 · Session 2025-26

Comments

Chat on WhatsApp