Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 43 pages
Exam (elaborations)

CSE 6040 Midterm 1 Questions and 100% Correct Answers 2026/27 Latest - Georgia Institute Of Technology.

Document preview thumbnail
Preview 4 out of 43 pages

CSE 6040 Midterm 1 Questions and 100% Correct Answers 2026/27 Latest -Georgia Institute Of Technology.

Content preview

CSE 6040 Midterm 1 Questions and 100% Correct Answers 2026/27 Latest-
Georgia Institute Of Technology.

Version 1.0.1

v1.0.1 - Fix Ex3 type hint; Added Ex6 clarification hint

All of the header information is important. Please read it..

Topics number of exercises: This problem builds on your knowledge of built-in python data structures
such as lists and sets, nested data structures, math as code, and basic algorithm concepts.
It has 9 exercises numbered 0 to 8. There are 18 available points. However to earn 100% the threshold is 13
points. (Therefore once you hit 13 points you can stop. There is no extra credit for exceeding this threshold.)

Exercise ordering: Each exercise builds logically on previous exercises but you may solve them in any order.
That is if you can't solve an exercise you can still move on and try the next one. Use this to your advantage as
the exercises are not necessarily ordered in terms of difficulty. Higher point values generally indicate more
difficult exercises.

Demo cells: Code cells starting with the comment ### Run Me!!! load results from prior exercises applied to
the entire data set and use those to build demo inputs. These must be run for subsequent demos to work
properly but they do not affect the test cells. The data loaded in these cells may be rather large (at least in terms
of human readability). You are free to print or otherwise use Python to explore them but we may not print them in
the starter code.

Debugging your code: Right before each exercise test cell there is a block of text explaining the variables
available to you for debugging. You may use these to test your code and can print/display them as needed
(careful when printing large objects you may want to print the head or chunks of rows at a time).

Exercise point breakdown:

Exercise 0 - : 2 point(s)
Exercise 1 - : 3 point(s)
Exercise 2 - : 2 point(s)
Exercise 3 - : 3 point(s)
Exercise 4 - : 1 point(s)
Exercise 5 - : 2 point(s)
Exercise 6 - : 2 point(s)
Exercise 7 - : 1 point(s) - FREE
Exercise 8 - : 2 point(s)

Final reminders:

Submit after every exercise
Review the generated grade report after you submit to see what errors were returned
Stay calm, skip problems as needed and take short breaks at your leisure




CSE 6040 Midterm 1

, In [ ]: ### Global imports
import dill
from cse6040_devkit import plugins, utils
from collections import defaultdict, Counter
from math import log
from pprint import pprint

utils.add_from_file('defaultdict_check', plugins)

In [ ]: with open('resource/asnlib/publicdata/user_items.dill', 'rb') as f:
users = dill.load(f)

with open('resource/asnlib/publicdata/games.dill', 'rb') as f:
games = dill.load(f)




The Problem: Creating a Recommender System
Background. As of 2024, Steam (https://en.wikipedia.org/wiki/Steam_(service%29) is the largest digital
distribution platform for selling and distributing video games. It hosts over 30,000 unique titles which are
available for consumer purchase. Consumers who purchase games on Steam are provided with an account.
These user accounts are tied to a user's game purchases, which makes it possible to see who owns which
games. The storefront also tracks information about the games it distributes, such as relevant tags, the number
of reviews, the text of individual reviews written by users, and more.

Your overall task. Your goal is to create an individually-tailored recommendation system for Steam. You will
create two recommendation systems by taking two different approaches:

1. Content filtering: you will try to recommend games which are similar to the games a user already likes.
2. Collaborative filtering: you will try to recommend games which other, similar users seem to like.

At the end, we will combine these results to create an ordered list of recommended games which a user could
purchase.

The datasets. You will work with two datasets to solve this problem. Both were obtained from the research
produced at The University of California, San Diego and Julian McAuley's research team, such as by Wang-
Chen Kang (https://cseweb.ucsd.edu/~jmcauley/). The datasets describe:

1. A set of games hosted on Steam and information relevant to those games, such as their price, the
name of the developer, and tags associated with the game.
2. A set of user profiles and associated information about them, such as the games they own and the
number of hours they have spent playing each game.

Both datasets are provided as Python lists. If you have not already done so, run the cells above this paragraph to
load the data into memory.




CSE 6040 Midterm 1

, Part 0: Data Exploration and Cleaning
Before we begin creating a recommendation system, we need to deal with the fact that our data are a bit messy.
Let's start by cleaning up our inputs and organizing them so it's easier to work with our information later.




Exercise 0: (2 points)
dictionary_key_frequency

Your task: define dictionary_key_frequency as follows:

To begin, it will be helpful to get a sense for what sorts of attributes we have access to in our input data and how
frequently we have access to that information. You will do this by completing the following task:

Calculate the frequencies of the keys found in a list of dictionaries.

Inputs:

list_of_dictionaries: A list of dictionaries.

Return:

key_frequencies: A dictionary.
The keys should be the be the keys found in the input dictionaries.
The values should be the frequencies of the keys.
The frequency of a key is calculated as the number of times it appears, divided by the
total number of dictionaries.
Frequencies should be rounded to six decimal places.

Hints

You may find the Counter() data structure, provided by the collections library
(https://docs.python.org/3/library/collections.html#counter-objects) helpful. It is not required to solve the
problem.




CSE 6040 Midterm 1

, In [ ]: ### Solution - Exercise 0
def dictionary_key_frequency(list_of_dictionaries: list) -> dict:
### BEGIN SOLUTION
keys = [key for element in list_of_dictionaries for key in element]
key_counts = dict(Counter(keys))
num_elements = len(list_of_dictionaries)
for key in key_counts:
proportion = round(key_counts[key] / num_elements, 6)
key_counts[key] = proportion

return key_counts
### END SOLUTION

### Demo function call
demo_list_of_dict = [
{"a": 1, "b": 2},
{"a": 3, "b": 11, "c": 4},
{"a": 5, "b": 6, "d": 7},
{"b": 8, "c": 9}
]
print('Here is the desired output for `demo_list_of_dicts`:')
pprint(dictionary_key_frequency(demo_list_of_dict))
print(' ----------------------------------------------------------------------------------- ')
print('Here are the keys in the dictionary and their frequencies for the demo
output:')
pprint(dictionary_key_frequency(games))



Example. RUN ME!
Whether your solution is working or not, run the following code cell. It will load the proper results into memory
and show the expected output for the demo cell above.


In [ ]: with open('resource/asnlib/publicdata/dictionary_key_frequencies_demo.dill',
'rb') as fp:
dictionary_key_frequencies_demo = dill.load(fp)




CSE 6040 Midterm 1

Document information

Uploaded on
February 27, 2026
Number of pages
43
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$18.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
DynamicNurse
4.0
(562)
Sold
3874
Followers
2916
Items
1916
Last sold
10 hours ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions