0% found this document useful (0 votes)
2 views11 pages

Week-3_Practice-Assignment

The document consists of several practice assignments that explore data organization and analysis through various scenarios, including grouping books, clustering customer spending, analyzing temperature trends, classifying movies, and studying student habits. Each question provides a method for data collection, visualization, and analysis, often suggesting the use of algorithms like k-means clustering or linear regression for automation. The challenges and considerations for each method are also discussed, highlighting the importance of data characteristics and external factors.

Uploaded by

hanuvardhan123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

Week-3_Practice-Assignment

The document consists of several practice assignments that explore data organization and analysis through various scenarios, including grouping books, clustering customer spending, analyzing temperature trends, classifying movies, and studying student habits. Each question provides a method for data collection, visualization, and analysis, often suggesting the use of algorithms like k-means clustering or linear regression for automation. The challenges and considerations for each method are also discussed, highlighting the importance of data characteristics and external factors.

Uploaded by

hanuvardhan123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

WEEK-2

PRACTICE ASSIGNMENT-2

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
If a bookshelf has many types of unlabeled books, they can be grouped
based on visible similarities such as genre, author, color, or size. For instance,
fiction books might go together, science books in another section, and all books by
the same author might be grouped close together. The features to focus on can
include genre, content theme, author’s name, publication type, or even color and
thickness. To teach a machine to organize these automatically, we can use
unsupervised learning, specifically a clustering algorithm. The algorithm detects
hidden patterns and groups similar data—without any existing labels—based on
features like text content. For example, if a computer analyzes hundreds of book
summaries, it might use text similarity or keyword frequency to form clusters such
as “science fiction,” “history,” or “children’s literature,” automatically.

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

Customer Amount Spent (₹) Num Items


1 530 16
2 120 4

3 315 9

4 690 21

5 155 5
6 510 13

7 80 2

8 400 11

9 245 7

10 690 19

11 90 3

12 360 8

13 230 6

14 600 18

15 105 4

16 320 10

17 180 5

18 775 23

19 260 9

20 530 15
After collecting customers’ purchase data (amount spent and number of items bought),
plotting these data points shows distinct buying behaviours. Visually, we could spot three
main groups:
 High spenders: buy many items and spend more money.
 Medium spenders: moderate spending and item count.
 Low spenders: fewer items and lower total cost.
To automate this, K-Means Clustering divides customers into clusters based on similarity
in spending and purchase quantity. The algorithm finds the “pivot” of each cluster and
assigns each customer to the nearest pivot.
Challenges:
 The results depend on the value of k (number of clusters).
 Sensitive to outliers—one very high spender can distort results.
 Only works effectively when clusters are roughly spherical and evenly sized.

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

Day Temperature (°C)

Day 1 30

Day 2 31

Day 3 32

Day 4 33

Day 5 32

Day 6 33

Day 7 34

Day 8 33

Day 9 34

Day 10 35

Day 11 36

Day 12 36

Day 13 36

Day 14 35

Day 15 36
Day 16 35

Day 17 34

Day 18 34

Day 19 35

Day 20 36

Plotting days on the x-axis and temperature on the y-axis shows an upward
trend.
A trend line (or best-fit line) using linear regression can model the
relation between day (x) and temperature (y). The line equation is y=mx+c ,
where m is the slope and c is the intercept.
If the slope shows the temperature rising by 0.5°C per day, the predicted
temperature for the next day (Monday next week) will be 37+ 0.5=37.5 °C .
The accuracy depends on environmental changes—unexpected rainfall, wind
speed, or humidity can shift the pattern.

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
To classify movies into genres such as "Action," "Comedy," or "Drama,"
you can look at features like the storyline, main characters, setting, and
ratings:
 For example, if a movie features lots of fight scenes, superheroes, and
fast-paced music, you can identify it as Action.
 If it involves jokes, light-hearted events, and cheerful settings, it's
likely Comedy.
 If the story is emotional, based on serious relationships or real-life
events, it's probably Drama.
We can teach a computer to do this using simple pattern analysis. For
example, collect movie ratings and reviews, and use regression
learning to find common patterns. Movies rated highly by those who like
laughter are likely comedies, while movies with dramatic reviews are
dramas.
How to do it:
 List each movie’s rating, storyline summary, and key features
(characters, setting, etc.).
 Let the computer look for patterns: are movies with high excitement
mentioned rated as action? Are movies with family-centered stories
rated as drama?
 Use regression to see if rating and genre are linked—movies with
certain features (intense action, emotional depth) get certain ratings.
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

Study Hours Sleep Hours


2 8
3 8.5
4 7
4 8
5 7
5.5 6.5
6 7.5
6.5 6
7 6.5
7 6
5 8
3.5 9
4 8.5
6 7
7.5 5.5
8 6
8 6.5
7 7
5 7.5
2.5 9
When plotted, clusters may form as follows:
 Cluster 1: Hardworking students (7–8 study hours, 4–5 sleep hours)
 Cluster 2: Balanced students (4–6 study hours, 6–8 sleep hours)
 Cluster 3: Relaxed students (2–3 study hours, 8–9 sleep hours).
These groups reveal behavior–outcome patterns such as “more study,
less rest,” which may affect health or performance.

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:
Average Grade Activities
A 2
B 4
C 1
B 5
A 3
A 5
B 6
C 2
C 3
B 2
A 1
B 3
C 1
A 2
B 4
C 1
B 2
A 4
C 3
A 5

When numerical values are assigned (A=3, B=2, C=1), plotting this
data reveals potential clusters:
 High achievers: High grades, moderate activities.
 Active all-rounders: Moderate grades, many activities.
 Focused students: Fewer activities but high grades.
This plot shows correlation patterns—students balancing academics
and extracurriculars may have slightly lower grades, but well-rounded
profiles.

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.

ANSWER:
Study Hours Exam Score (%)
2 45
4 62
5 70
7 85
8 92
By estimating the line of best fit, we use the general format:
Exam Score=m×(Study Hours)+ c
Given these data points, we can approximate:
 Slope m ≈7 (each extra hour of study increases score by about 7 marks)
 Intercept c ≈ 31
So, the equation is:
Exam Score=7 ×(Study Hours)+31
Explanation:
As study hours increase, exam scores also rise, showing a positive
correlation. The linear trend line summarizes this relationship, letting us
predict scores for other study hours. For example, if a student studies 6
hours:
Predicted Score=7 ×6+ 31=73
This prediction is quite accurate, but actual results may vary due to other
factors like study quality or exam difficulty.

You might also like