Week-3 Practice Assignment 2 Answersheet
Question-1
Imagine you are organizing a bookshelf with many different types of books but no labels or
categories. How would you group the books together? What features would you look at to decide
which books go together (e.g., genre, author, size)? Now, think about how you would teach a
machine to do this automatically without any pre-existing categories.
Answer
I would focus on the features of the genre, as it is the aspect that differentiates one book from
another. I would train the machine using an unsupervised learning approach, specifically a
clustering model.
Question-2
Go to your local grocery store and request for the customers' purchase data. The data should
include the amount spent and the number of items purchased by each customer. Plot this data
on a graph with 'amount spent' on one axis and 'number of items' on the other. Now, try to group
the customers into three clusters (high spenders, medium spenders, low spenders). How would
you decide which customers belong to which group? Now, think about how k-means clustering
could help automate this process. What might be the challenges of using k-means for this task?
Answer
The data was collected online instead from a local shop.
I would group them based on the amount spent; for example, high spenders tend to make a
larger number of high-value purchases. K-means can help by automatically forming clusters
based on similarities in the data.
One challenge with using the K-means method is that the clusters may not be perfect, as some
patterns in the data can overlap.
Question-3
Consider the daily temperature (in degrees Celsius) in your city over the past week. Record the
temperatures and the corresponding day of the week. Plot the data on a graph with the day of
the week on the x-axis and the temperature on the y-axis. Draw a trend line that shows how the
temperature is changing over the week. Use this trend line to predict the temperature on the next
day (the day after your last recorded data). Describe your prediction process.
Answer
Firstly , the data was plotted on the graph and a line was selected to tell the trend of the week.
A line was selected that minimizes differences between predicted and actual temperatures.
Temperature can be predicted using the line and the formula :
y = mx + c
Question-4
Think about five movies you have watched recently. Create a table with two columns: "Movie
Title" and "Genre." In the "Genre" column, classify each movie into categories such as "Action,"
"Comedy," "Drama," etc. Now, think about the characteristics of these movies that led you to
classify them this way (e.g., storyline, setting, characters). Describe how you could teach a
computer to automatically classify movies into genres based on these characteristics.
Answer
Movie Title Genre
Thamma Horror comedy
Interstellar Sci fi
Salaar Action
inception Sci-Fi
Dhamal Comedy
The classification were made on the basis of storyline and the visuals of the movie. I would teach
the machine this by using a supervised learning approach, specifically feature factors.
Question-5
Survey your classmates on the number of hours they study and sleep each day. Create a table
with two columns: "Study Hours" and "Sleep Hours." Plot this data on a scatter plot, with "Study
Hours" on the x-axis and "Sleep Hours" on the y-axis. Identify clusters of students who have
similar study and sleep patterns. Describe the characteristics of each cluster (e.g., students who
study a lot but sleep less).
Answer
I am not able to answer this question
Question-6
Ask your classmates about their average grades (e.g., A, B, C) and the number of extracurricular
activities they participate in. Create a table with "Average Grade" and "Number of Extracurricular
Activities." Plot this data on a scatter plot, with "Average Grade" on the x-axis (you can assign
numerical values to grades) and "Number of Extracurricular Activities" on the y-axis. Identify
clusters of students who have similar grades and activity levels. Discuss any patterns and what
they might indicate.
Answer
Students with a high number of activities and high average grades are high achieving students,
Students with a high number of activities , but low scores are distracted students. Meanwhile ,
students with low scores and a low number of activities are struggling.
Question-7
Survey your classmates on the number of hours they studied for a recent exam and their scores
on that exam. Create a table with two columns: "Study Hours" and "Exam Score." Plot this data
on a scatter plot, with "Study Hours" on the x-axis and "Exam Score" on the y-axis. Draw a trend
line (line of best fit) through the data points. Based on this line, predict the exam score of a
student who studied for a specific number of hours. Discuss how accurate this prediction might
be and what other factors could influence the exam scores.
Data used in the plot :
Student Study Hours Exam Score
Kunal 2 50
Sakshi 4 65
Arush 6 70
Sahil 8 80
Bhuvan 10 90
The line equation can be used to predict scores with study hours :
y = mx +c
And for the prediction line in graph equation is :
y=4.82x+40.14