CBSE Class 11 AI Machine Learning Basics 2025-26 | Linear Regression KNN K-Means | Code 843 Unit 6 Notes
📥 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.
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.
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!
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.
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
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
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}")
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.
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.
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]]}")
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.
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!
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_)
Quick Comparison — All Three Algorithms
Important Viva & Board Exam Questions
- 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
📲 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
Comments
Post a Comment