Dataset Viewer
Auto-converted to Parquet Duplicate
_id
string
text
string
image
image
925
4.5 Chained decisions 107 b. All operators are evaluated right to left. C. Order is random when parentheses aren't used. 8. Given x = 8 and y = 9, what is the result of the following? X + 3 * y 5 a. 30 b. 44 C. 94 9. Given x = 8 and y = 9, what is the result of the following? (x+3) * (y-5) a. 30 PEP 8 RECOMMENDATIONS: ...
926
156 6 Functions Using local and global variables together Python allows global and local variables to have the same name, which can lead to unexpected program behavior. A function treats a variable edited within the function as a local variable unless told otherwise. To edit a global variable inside a function, the var...
927
6.4 Parameters 161 uses a pass-by-object-referenne system. If an argument is changed in a function, the changes are kept or lost depending on the object's mutability. A mutable object can be modified after creation. A function's changes to the object then appear outside the function. An immutable object cannot be modif...
928
162 6 Functions CONCEPTS IN PRACTICE Mutability and function arguments 8. In convert_temps (), wknd_temps and temps refer to in memory. a. the same object b. different objects 9. After unit is assigned with "C", metric and unit refer to in memory a. the same object b. different objects 10. deg_sign is a string whose va...
929
170 6 Functions a. Hello Friend b. nothing C. Error PEP 8 RECOMMENDATIONS: SPACING The PEP 8 style guide recommends no spaces around = when indicating keyword arguments and default parameter values. TRY IT Stream donations Write a function, donate (), that lets an online viewer send a donation to a streamer. donate () ...
930
182 7 Modules print (fcN to meet you, {name}!") live = input ("Where do you live? ") print (ff{live} is a great place.") a. true b. false Using Python modules often include the statement if name == "-main__ " "to prevent side effects. This statement is true when the module is run as a program and false when the module ...
931
7.3 Top-level code 183 C. math main 6. What line is useful for preventing side effects when importing? a. if name == "main": b. if name == main c. if name main EXPLORING FURTHER Variables that begin and end with double underscores have special meaning in Python. Double underscores are informally called "dunder" or "mag...
932
190 7 Modules Built-in modules The Python Standard Library is a collection of built-in functions and modules that support common programming tasks. Ex: The math module provides functions like sqrt() and constants like pi. Python's official documentation includes a library reference (fttps///pepestxx.rrrr/oo/ottltp and ...
933
194 7 Modules Notice how leap years are included in the calculation. February 29th occurs four times between birth and today. Therefore, the user is not only 15 years old, but 15 years and 4 days old. Many commonly used modules from PyPI, including arrow, are installed in the Python shell at python.org/ shell (atpp///p...
934
8.4 String formatting 209 C. ValueError 15. What is the output of the following code? sentence = "This is a sentence" index = sentence.index ") print [:sentence[:indeee a. "This" b. "This " C. "sentence" TRY IT Finding all spaces Write a program that, given a string, counts the number of space characters in the string....
935
8.4 String formatting 211 b. Hello Ana C. Hello Ana! 2. What is the output of print("{}:{} format ("One", "1"))? a. Onel b. One: 1 c. 1:0ne 3. What is the output of print ("{}" .oormat ("one", "two", "three") ) a. one b. two c. onetwothree Named replacement fields Replacement fields can be tagged with a label, called n...
936
212 8 Strings S = "Weather in {season} is {temperature}; very very {temperature). print(s) pr. (season = "summer", temperature = "hot")) print(s.format (temperature = "cold", season = "winter")) The above code's output is: Weather in {season} is {temperature}; very very {temperature} Weather in summer is hot very very ...
937
8.4 String formatting 213 Home Numbered replacement fields can use argument's values for multiple replacement fields by using the same argument index. The example below illustrates how an argument is used for more than one numbered replacement field. EXAMPLE 8.8 Numbered replacement field to build a phrase Numbered rep...
938
214 8 Strings formatted table. The field width in string format specification is used to specify the minimum length of the given string. If the string is shorter than the given minimum length, the string will be padded by space characters. A field width is included in the format specification field using an integer aft...
939
BUDGET GUALL POWER 25 125 1 it tts Recoived (54 31 2) $54 orria Day 3) their water ailable 24/7! MRC M- MuRC % 8 9 7 MU UTILITY BILL REMIT PORTION 5 6 4 mber and Customer Number on portion of bill with your payment. 2 3 1 AC Due Date 12/23/2020 Amount Due 00 $54.69 0 C-CE Electronic care Works Board Lists Figure 9.1 cr...
940
224 9 Lists EXAMPLE 9.1 Simple operations to modify a list The code below demonstrates simple operations for modifying a list. Line 8 shows the append() operation, line 12 shows the remove () operation, and line 17 shows the pop () operation. Since the pop() operation removes the last element, no parameter is needed. 1...
941
248 10 Dictionaries Dictionary mutability In Python, a dictionary is a mutable data type, which means that a dictionary's content can be modified after creation. Dictionary items can be added, updated, or deleted from a dictionary after a dictionary object is created. To add an item to a dictionary, either the square b...
942
10.3. Dictionary operations 249 print (my_dict) # Output: {"apple": 2, "orange": 4}} CHECKPOINT Modifying dictionary items Access multimedia content http:/poeeeaaaooooooooooooooooeo CONCEPTS IN PRACTICE Modifying a dictionary Given the dictionary food = {"Coconut soup": "$15", "Butter Chicken": "$18", "Kabob": "$ answe...
943
260 10 Dictionaries 1003: {"name": "Charlie", "department": "Engineering"; "salary": 80000} 1004: {"name": "Dave", "department": "Marketing"; "salary": 60000}; 1005: {"name": "Eve", "department": "Sales", "salary": 55000} Resulting dictionary: "Engineering": {1001: {"name": "Alice", "salary": 75000}, 1003: {"name": "Ch...
944
262 | 10 Dictionaries | | | Concept | Description | | Adding a new key-value pair or updating an existing key-value pair | # Updating an item using square bracket # Adding a new key-value pair using square bracket notation my_dict[key3] value3 = my_dict {keyl: valuel, key2: value2} notation my_dict[kky]] new vaw_v # U...
945
276 11 Classes Refilled 100 Current stock: Access multimedia content http Overloading operators Learning objectives By the end of this section you should be able to Identify magic methods and describe their purpose. Develop overloaded arithmetic and comparison operators for user-defined classes Magic methods and custom...
946
280 11 Classes a. def le_ (other): : return self.amount <= other.amount b. def _e_ (self, other) : return self.amount <= other.amount C. def le_ (self, other) return other.amount <= self.amount 9. Which type of value does gt () return? a. account instance b. Boolean C. integer TRY IT Combining exercise logs The Exercis...
947
12.2 Simple math recursion 289 5. How many total steps does it take to solve three rings? a. 3 b. 4 C. 7 6. How many total steps does it take to solve four rings? a. 15 b. 7 C. 3 Simple math recursion Learning objectives By the end of this section you should be able to Identify a recursive case and a base case in a rec...
948
290 12 Recursion 3. Listing the primary numbers (prime numbers) greater than 3. 4. Listing the Fibonacci sequence of numbers. Defining a recursive function Recursive algorithms are written in Python as functions. In a recursive function different actions are performed according to the input parameter value. A critical ...
949
12.4 More math recursion 295 Recursive Fibonacci function def fib(n) # Base case if n == 0 or n == 1: return n # Recursive case elif n > 1: return fib(n - 1) + fib - 2) # Error case else: print ("Fibonacci numbers begin at 0. ") return # &Test code print (fib (7) The above code's output is: CHECKPOINT Recursive Fibonac...
950
296 12 Recursion a. tree b. recursion tree C. iteration tree Greatest common divisor (GCD) The greatest common divisor (GCD) of two positive integers is an integer that is a divisor for both integers. Ex: The GCD of 6 and 9 is 3 because 3 x 2 6, and 3 x The GCD is found easily using Euclid's method. Euclid's method rec...
951
298 12 Recursion Binary search Searching a sorted list usually involves looking at each item. If the item being searched is not found, then the search can take a long time. A binary search is a recursive algorithm used to efficiently search sorted lists. In each recursive step, about half the items are discarded as not...
952
300 12 Recursion EXAMPLE 12.4 Solving N towers The solution to Three Towers is simple with recursion. In the code below, rings are numbered from the top down. The smallest ring is 1, the next ring is 2, and when solving for three rings, the bottom ring is 3. Solving the towers problem recursively def three_towers (N, s...
953
314 13 Inheritance class ContractTax: def _nnn (self, value): self.value = value def calc_tax(self): print ("Calculating contracts tax") total = 0.15 * self.value # To replace with calculation return total my_tax = Contracttax(value=100) # Replace 1000 with any value result = my_tax.calc_tax() print (f"Total tax: $fres...
954
316 13 Inheritance TRY IT Using super( Given the Employee class, create a Developer class inherited from Employee with methods __ntt___ () and print_info() such that: Uses super () to call Employee's init () to initialize e_id and hire_year. Assigns lang_xp with list parameter Lang_xp. print_info() Uses super() to prin...
955
13.4 Hierarchical inheritance 317 Class C inherits from Class D 2. Which group of classes is hierarchical inheritance appropriate for? a. Cat, Dog, Bird b. Employee, Developer, SalesRep C. Dessert, BakedGood, ApplePie Implementing hierarchical inheritance Multiple classes can inherit from a single class by simply inclu...
956
318 13 Inheritance mem_13 = Tenor() mem_15 = Sopranol() mem_10.display () print() mem_13.display () print() mem_15.display () The code's output is: Current choir member Part: Alto Current choir member Part: Tenor Current choir member Part: Soprano Division: Soprano 1 CONCEPTS IN PRACTICE Implementing hierarchical inher...
957
324 13 Inheritance Polymorphism describes a single representation for multiple forms and is applied in Python to define multiple methods with the same name and allow the same method to take different arguments. Hierarchical inheritance is a type of inheritance in which multiple classes inherit from a single superclass....
958
13.6 Chapter summary | Task | Example | | | class SuperClass: Sriint('Superclas method') def display(self): | | Implement hierarchical inheritance | class SubClass1(SuperClasss: def display(self) Brint('Subclass 1 method )) class SubClass2(SuperClass) def display(self):: (aint((Suuclan 2 method') | | | class SubClass...
959
14.1 Reading from files 329 55 5 91 *""Demonstrating read() and readlines()" """ # Using read() # Open the file and associate with a file object infile = open("input.txt") # Read the contents of the file into a string str1 infile.read() # Print str1 (rinult of using read():") (strt(strl) # Always close the file once do...
960
1.6 Error messages 25 CONCEPTS IN PRACTICE Parts of an error Parts or an error an Given the following error message: Traceback (most recent call last): File f/hone/stttutttttee/////o//aap// line 2 print "test" SyntaxError: Missing parentheses in call to 'print' Did you mean "rint("test") 1. What is the filename of the ...
961
14.2 Writing to files 333 The write () function writes automatically to a temporary store called the file buffer. To ensure that the information is written to a file, the close () function must be used. The close () function finalizes changes and closes the file. EXAMPLE 14.2 Writing and appending to a file """Operatio...
962
14.3 Files in different locations and working with CSV files 335 b. The line "new content" is added to the end of resources. TRY IT Writing to a new file Write a line of text to a file called out.txt. Don't forget to use close (). out.txt should only have the line of text that you have written. Access multimedia conten...
963
14 Files | Operating System | File location | open () function example | | Mac | /users/student/ | fileobj open ("/users/sttudnn//uuupppttttt = | | Linux | /usr/code/ | fileobj open ("/us//codeootpputtttxx)) | | Windows | X:Aprojects) code\ | fileobj = open ("c://projeeesss/cccoouutptttttp or fileobj open Wpco\erroject...
964
14.4 Handling exceptions 339 EXPLORING FURTHER Files such as Word documents (.docx) and PDF documents (.pdf), image formats such as Portable Network Graphics (PNG, .png) and Joint Photographic Experts Group (JPEG, .ppe or .jpg as well as many other file types are encoded differently. Some types of non-Unicode files can...
965
340 14 Files EXAMPLE 14.4 Typo in a file A file named food_ordertxt has the following contents: 5 sandwiches 4 chips 1 pickle soft drinks The following program expects each line of the file to begin with an integer: for line in open "'food_order.txtee space = lineeindex(" ") qty = int (line[: item = Line[space+1:-1> pr...
966
14.4 Handling exceptions 341 3. parts = line split() qty = parts[0] item = parts[1] a. FileNotFoundErron b. IndexError C. ValueError EXPLORING FURTHER The Built-in Exceptions (htpp://pnnstxoogrr//Oxxxcxxpte page of the Python Standard Library explains the meaning of each exception. Try and except Programs can be design...
967
344 14 Files httpss//ppenttxx.rrrrrrOococcte from Worldometer. Each line of the file includes a country's name, population, land area, and population density, separated by commas. The user might incorrectly type the filename (Ex: countries.txt instead of countries.csv). Your program should output an error message if th...
968
346 14 Files C. TypeError: missing argument 2. raise "eizzError("Innaaa size") a. Invalid size b. PizzaError: Invalid size C. NameError: name 'PizzaError' is not defined 3. raise ValueError a. ValueError b. NameError: name 'ValueError' is not defined C. SyntaxError: Missing parenthesis in call to 'ValueError' TRY IT Th...
969
15.4 Exploratory data analysis 365 5. Which of the following returns the second row? a. df.iloc [2] b. [f[ c. df. loc[1] 6. Which of the following returns the first column? a. df.loc[0, :] b. df.iloc[:; 0] C. df. lo"["A"] 7. Which of the following results in selecting the second and fourth rows of the DataFrame? a. [f[...
970
15.5 Data visualization 373 Table 15.11 Matplotlib functionalities. Histogram plot. Values Histogram plot Example # Create the histogram plt.hist (data, bins=30, edgecolor="black") -4 -3 -2 -1 0 1 2 3 # Customize the chart (eatiii((eHiiogoig of random values") plabxlabel ("Values") plabylabel ("Frequency") Frequency 0 ...
971
378 | 15 Data Science | | | Function | Description | | sltttcaxter(xx y) | Takes in two inputs, x and y, and plots points representing (x, y) pairs. | | | Takes in one input, x, and plots a histogram of values in x to show distribution trend. or | | plt. boxplot (x) | Takes in one input, x, and represents minimum, ma...
972
2.4 Floating point errors 1. b. An overflow error occurs because the value is larger than the upper limit of the floating-point range. 2. a. The digits starting from the eighteenth place after the decimal are inaccurate due to approximation, so a round-off error occurs. 3. C. round (6. 6) = 7 as 7 is the closest whole ...
973
9. b. The global keyword can be used to create a global variable from within a function. new_hour has global scope and can be accessed outside update_hour(). 6.4 Parameters 1. b. username is the argument passed to print_welcome (). name is print_wel come ()'s parameter that is assigned with use rname's value. 2. a. nam...
974
Chapter 7 7.1 Module basics 1. b. The code has ten def statements, each of which defines a function. 2. a. Many modules consist of function definitions only. The functions are intended to be called in other modules. 3. C. area. cube (5) is 6 * ***2, which is 6 * 25, which is 150 4. a. When importing a module from anoth...
975
index for the first occurrence of "a" is 1. 11. b. Since "c" is not a substring in "banana" the find () method returns -1. 12. a. Since "banana" is not a substring of "b" -1 is returned. 13. a. The index () method returns the index of the start of the first occurrence of a substring in the given string. The index of th...
976
6. The for loop ranges from 0 through 20, stepping by two, but each iterated element is even, so nothing is added to new_list. Chapter 10 10.1 Dictionary basics 1. a. The first item in each key-value pair is the key. Hence "Sunday", "Monday", "Tuesday" are key items. 2. b. The second item in each key-value pair is the ...
977
middle tower, taking seven steps as in question 2. One step is needed to move the biggest ring from the source to the target. It takes seven more steps move three smaller rings from the middle to the target. The total is 7 + 1 + 7= 15 steps. 12.2 Simple math recursion 1. The summation can be calculated using recursion ...
978
4. b. Square's superclass is Rectangle. Rectangle's init () is called on line 6. 5. a. super (). init (4) calls the init () of Rectangle's superclass, Polygon. Control moves to line 3, and num_sides is initialized with 4. 6. b. The instance attribute side is initialized with 5. 7. b. Rectangle's _iit () always calls Po...
979
3. b. Python interprets this command as the programmer trying to print the object details. The object details lmm=='ewffle.too mode='r' encoding='cp1252% 4. c. The read() function is called on fileobj. The file's contents will be read into file_str. are printed. Ex: <_ io. TextIOWrapper 5. b. The readlines () function ...
980
2.6 The math module 55 Distinguish between built-in functions and math functions. Use functions and constants defined in the math module. Importing modules Python comes with an extensive standard library (htpps//opentttx.rrr///oo/potp/p of modules. A module is previously written code that can be imported in a program. ...
981
60 2- Expressions Formatting code Learning objectives By the end of this section you should be able to Identify good spacing for expressions and statements. Write multi-line statements using implicit line joining. Recommended spacing Most spaces in Python code are ignored when running programs; however, spaces at the s...
982
| | | 2.7 Formatting code | | Guideline | Example | Common Mistakes | | Parentheses: no space before or after. | print("G team!") | print ("Go team!") print "Go team!" ) ( | | Commas: no space before, one space after. | name) | print ("Hello" name) print ("Hello", name) | | Assignment: one space before and after the=...
983
62 2- Expressions a. b** 2 - ****** c b. b ** 2 - 4 * a * c C. b**2 - 4* * c Automatic concatenation Long strings make Pytnon programs aimicuut to read. EX. This program prints une tir lirst sentence or tne Declaration of Independence ltttpss/pppetttooogg//bdeeeeeeo print("The unanimous Declaration of the thirteen unit...
984
76 3 Objects the amount was three, but other amounts (besides 0) would work too. Write a program that prompts the user to input the following two values (example input in bold): Enter a 3-letter word: CAT Shift by how many letters? 3 The program should then shift each letter of the word by the desired amount. Based on ...
985
3.5 Tuple basics 85 [2, 3, 5, 7, 11] CONCEPTS IN PRACTICE List indexes and the len() function 3. Which is the correct way to access the 17th element in a list called cardList? a. card_list[17 b. 16)daardlist (16) C. card_list[16] 4. What is the correct way to modify the element "Tom" to "Tim" in the following listi nam...
986
120 3. "ata Structures and Algorithms Data Structure Problems Data structure problems are not only useful for implementing data structures, but also as fundamental algorithm design patterns for organizing data to enable efficient solutions to almost every other computing problem. Searching Searching is the problem of r...
987
3.5 Sample Algorithms by Problem 121 elements where elements are not assigned numeric values but rather defined in relation to other elements. For simplicity, the data are typically assumed to be stored in an array list for indexed access, and the sorting algorithm can either return a new sorted list or rearrange the e...
988
122 3. Data Structures and Algorithms Figure 3.24 Heapsort uses the binary heap data structure to sort elements by adding and then removing all elements from the heap (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license) Many comparison sorting algorithms share the same O(Nlog N) runtime bound wit...
989
3 Chapter Review 131 Chapter Review Key Terms abstract data type (ADT) consists of all data structures that share common functionality abstraction process of simplifying a concept in order to represent it in a computer adjacent in graph abstract data type, the relationship between two vertices connected by an edge algo...
990
132 3 Chapter Review cost model characterization of runtime in terms of more abstract operations such as the number of repetitions count sorting sorting a list of elements by organizing elements into categories and rearranging the categories into a logical order cryptography problem of masking or obfuscating text to ma...
991
134 3 Chapter Review time complexity formal measure of how much time an algorithm requires during execution as it relates to the size of the problem tractable problems that computers can solve in a reasonable amount of time traveling salesperson problem (TSP) problem of, given the path cost of every pair of vertices, f...
992
140 3 Chapter Review 11. Why might we prefer a sub-optimal greedy algorithm over a correct brute-force algorithm? 12. What's problematic about the statement, "municipal broadband planning reduces to Kruskal's algorithm"? 13. Describe the relationship between the pivot element and the left and right sublists after the f...
993
3 Chapter Review 141 10. What two sublists are combined in the final step of merge sort on the list [9, 8, 2, 5, 4, 1,3, 6]? 11. If a connected graph has unique edge weights, will Kruskal's algorithm find the same minimum spanning tree as Prim's algorithm? How about a connected graph with duplicate edge weights? 12. Wh...
994
4.1 Models of Computation 151 mov ecx, ebx mov esp, edx mov edx, r9d mov rax, rdx 100101011001 010011111011 Assembler 111010101101 010101010101 Assembly language Machine code Figure 4.7 An assembler is a program that translates assembly language source code into machine object code. (attribution: Copyright Rice Univers...
995
152 4.Linguistic Realization of Algorithms: Low-Level Programming Languages Figure 4.8 As a rule, high-level languages are less laborious to write, and slower to execute, than low-level languages. High-level languages typically do not support direct hardware control. (attribution: Copyright Rice University, OpenStax, u...
996
154 4.Linguistic Realization of Algorithms: Low-Level Programming Languages imperative steps to evaluate the functions. == lambda x: x+ print (f(1)) LAMBDA is a function in Python Output is 2 Figure 4.10 This diagram shows a functional programming example using Python. Here the function "LAMBDA" is used to increment th...
997
156 4.Linguistic Realization of Algorithms: Low-Level Programming Languages There is a substantial upside to making a language structured, and the only significant downside is that it makes the language a bit more high-level. Therefore, among programming languages that are currently in widespread use, all the middle-le...
998
4.1 Models of Computation 157 Syn (establish connection to request) sent Syn + Ack (response to request) Syn (acknowledgment, connection established) Figure 4.13 This diagram demonstrates various functions used by the socket on both the client and the server side to establish and close connection. (credit: modification...
999
4.3 Parallel Programming Models 177 All these events caused a severe shortage. Customers encountered long waiting lists for GPUs, or found that they were unavailable entirely. Scalpers sold GPUs at a substantial upcharge. Some people were unable to buy video games, or computers they needed to complete work. The shortag...
1000
4 Chapter Review 185 hardware model design for a how a specific physical computer executes algorithms high-level programming language programming language that operates at a high level of abstraction, meaning that low-level details such as the management of memory are automated imperative programming paradigm in which ...
1001
198 S.Hardware Realizations of Algorithms: Computer Systems Design (Figure 5.3). This special software that translates HLLs to executables includes tools called compilers, assemblers, and linkers. We will not discuss these tools here, (refer to 5.2 Computer Levels of Abstraction anc 5.4 Machine-Level Program Representa...
1002
206 5.Hardware Realizations of Algorithms: Computer Systems Design Step 4: Store instruction in memory Figure 5.9 Although it may just take seconds to execute, there are several steps included in a microarchitecture process to deliver results for the user. (attribution: Copyright Rice University, OpenStax, under CC BY ...
1003
5.2 Computer Levels of Abstraction 207 way using a file system. The file system helps organize files so that it is easier to find them when needed. Monitor Keyboard Figure 5.10 The operating system functions as a manager that connects the hardware in the computer to the software. (attribution: Copyright Rice University...
1004
210 S.Hardware Realizations of Algorithms: Computer Systems Design example, to get the one's complement of 011, we do it in two steps. First, we get the one's complement: 011 is 100. Second, we add to the result: 100 101, and 101 is the two's complement of 011. Now that we know the definition of two's complement, let u...
1005
216 5.Hardware Realizations of Algorithms: Computer Systems Design LINK TO LEARNING There has been a debate among companies who are designing hardware as to whether CISC or RISC is better. Read this article chronicling this debate hhtpp://oeeakaoogg/o/eeeeesss}} from MicrocontrollerrTips Assembly and Machine Code In ou...
1006
222 5.Hardware Realizations of Algorithms: Computer Systems Design CC BY 4.0 license) In this section, we explore memory technology. We will discuss the different technologies by which memory is built, explain what we mean by memory hierarchy, and see what researchers have done to deal with the processor-memory gap. Me...
1007
226 S.Hardware Realizations of Algorithms: Computer Systems Design piece of data, the overall system performance is very low; therefore, computer designers speed things up by using a faster technology together with the DRAM. This faster technology, technology 1 in Figure 5.20 is called the SRAM. Memory: SRAM There are ...
1008
5.5 Memory Hierarchy 227 memory, which are in the cache. Now, if the processor wants A[1], it finds it right away in the cache, which is called a cache hit. However, if the processor instead needs A[17], then we have another cache miss and the cache gets to the memory again to bring several elements, including A[17]. B...
1009
5.5 Memory Hierarchy 229 DRAM memory's access latency is M cycles and the cache access latency is m. Also assume that for a specific program the probability of cache hits p. Then the average latency of the combined cache Memory mp (1 p)(M m) m- (1 P)M. Remember that whenever there is a cache miss, we have already spent...
End of preview. Expand in Data Studio

NanoViDoRe v3 — WIP NanoBEIR-format conversion

This is a temporary, work-in-progress dataset for experimentation. The format is not final and may change without notice. This repository will be moved, renamed, or deleted in the future (for example, once a canonical location is agreed on). Please do not depend on it for anything long-lived. For the original dataset, use lightonai/NanoViDoRe_v3.

What this is

A re-packaging of lightonai/NanoViDoRe_v3 (revision 0ae74913373848e65871c072831ef30f710642ce) into the same layout as the NanoBEIR datasets (e.g. sentence-transformers/NanoBEIR-en): one split per task, each with its own corpus, queries and qrels.

It was created to explore whether a generic Nano-set evaluator in Sentence Transformers (discussion: huggingface/sentence-transformers#4327) can evaluate visual document retrieval without any dataset-specific loading code.

No content was added, removed or edited. Only the layout and column names changed:

  • The original shares one 4,000-page corpus across all 8 tasks and separates tasks with a source_dataset column. Every original qrel points to a page of its own source_dataset (0 of 2,061 cross-task qrels), so each page was assigned to the split of its source_dataset. The total number of pages is unchanged (4,000).
  • Columns were renamed to the NanoBEIR convention. IDs are strings.

Structure

Configs: corpus, queries, qrels. Splits (identical across configs): computer_science, energy, finance_en, finance_fr, hr, industrial, pharmaceuticals, physics.

config columns
corpus _id (str), text (str, the OCR markdown of the page), image (page image)
queries _id (str), text (str), language (str), query_format (str)
qrels query-id (str), corpus-id (str), score (int, graded: 1 = critically relevant, 2 = fully relevant)
split corpus queries qrels
computer_science 358 50 227
energy 434 50 200
finance_en 548 50 255
finance_fr 479 50 221
hr 365 50 283
industrial 894 50 320
pharmaceuticals 455 50 226
physics 467 50 329

Queries are spread evenly over 6 languages (en/fr/de/es/it/pt), as in the original.

Usage

from datasets import get_dataset_split_names, load_dataset

dataset_id = "hotchpotch/NanoViDoRe_v3_WIP_converted"
for split in get_dataset_split_names(dataset_id, "qrels"):
    corpus = load_dataset(dataset_id, "corpus", split=split)    # use "image" for visual retrieval, "text" for OCR text
    queries = load_dataset(dataset_id, "queries", split=split)
    qrels = load_dataset(dataset_id, "qrels", split=split)

Scores are not comparable with the original protocol

The original README evaluates every query against the full merged 4,000-page corpus. Here each task only searches its own pages, so pages from other tasks no longer act as extra distractors and scores are somewhat higher.

Example with vidore/colqwen2-v1.0, mean nDCG@10 over the 8 tasks:

setting binary qrels graded qrels
original (merged 4,000-page corpus) 0.4663 0.4685
this conversion (per-task corpus) 0.4876 0.4889

License

Same terms as the source datasets. The query/qrels annotations of ViDoRe v3 are released under CC BY 4.0. The page images and their markdown text inherit the license of their original publishers (public domain, CC BY 4.0, Etalab 2.0, CC BY-SA 3.0 and other open reuse licenses); see the documents_metadata config of each ViDoRe v3 dataset for the per-document license.

Citation

Please cite the original works:

@misc{loison2026vidorev3,
  title         = {ViDoRe V3: A Comprehensive Evaluation of Retrieval Augmented Generation in Complex Real-World Scenarios},
  author        = {António Loison and Quentin Macé and Antoine Edy and Victor Xing and Tom Balough and Gabriel Moreira and Bo Liu and Manuel Faysse and Céline Hudelot and Gautier Viaud},
  year          = {2026},
  eprint        = {2601.08620},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  url           = {https://arxiv.org/abs/2601.08620},
}

The Nano subsampling is by LightOn: lightonai/NanoViDoRe_v3.

Downloads last month
-

Paper for hotchpotch/NanoViDoRe_v3_WIP_converted