Dataset Viewer
Auto-converted to Parquet Duplicate
question
stringlengths
19
3.53k
answer
stringlengths
1
5.09k
label
float64
0.1
0.1
source
stringlengths
20
22
In Itanium's procedure call and return mechanism, What problem might arise when the processor executes erb+alloc+? Which mechanisms could be used to handle the problem? Feel free to mention what Itanium actually does (if you recall it), but list any effective solution th...
val THRESHOLD = ??? def aggregate(z: B)(f: (B, A) => B, g: (B, B) => B): B = def go(s: Splitter[A]): B = if s.remaining <= THRESHOLD then s.foldLeft(z)(f) else s.split .map((t: Splitter[A]) => task { go(t) }) .map(_.join()) .reduce(g) go(splitter)
0.1
M1_preference_data_0
List two common types of exceptions which could possibly be implemented imprecisely. Explain why.
S1: q1: P=4/8 R=4/4 q2: P=1/5 R=1/2 q3: P=3/9 R=3/5 q4: P=3/9 R=3/4 mean P(S1) = 41/120 mean R(S1) = 57/80 S2: q1: P=1/5 R=1/4 q2: P=2/4 R=2/2 q3: P=3/5 R=3/5 q4: P=2/4 R=2/4 mean P(S1) = 9/20 mean R(S1) = 47/80
0.1
M1_preference_data_1
What differentiates VLIW processors from out-of-order superscalar processors?
The app could stream images rather than batch them, to only download images the user actually sees
0.1
M1_preference_data_2
A multiset is an unordered collection where elements can appear multiple times. We will represent a multiset of Char elements as a function from Char to Int: the function returns 0 for any Char argument that is not in the multiset, and the (positive) number of times it appears otherwise: 1 type Multiset = Char => Int W...
Recall that a \emph{base} of a matroid is an independent set of maximum cardinality. Let $B \in \mathcal{I}$ be a base of $\mathcal{M}$. Suppose towards a contradiction that the output $S \in \mathcal{I}$ of \textsc{Greedy} is not a base of $\mathcal{M}$. Then $|S| < |B|$, and, by the second axiom of matroids, there ex...
0.1
M1_preference_data_3
Consider a classic pipeline with Fetch, Decode, Execute, Memory, and Writeback stages such as MIPS's. Give an example snippet made of 2-3 instructions (use any credible assembly language) which would benefit from a forwarding path between the Memory and Execute stage (assume that no other forwarding paths exist...
It is not suitable as the item is not specified properly ("doesn't render well" is not concrete). A bug item has to include details on what is wrong with the user experience.
0.1
M1_preference_data_4
Let us remind that we define the max-margin $M_\star$ as egin{align*} M_\star = \max_{\wv\in\mathbb R^D, \| \wv\|_2=1} M ext{ such that } y_n \xv_n^ op \wv \geq M ext{ for } n=1,\cdots, N \end{align*} and a max-margin separating hyperplane $ar \wv$ as a solution...
$P( ext{continuous wave})= rac{2}{58}$ since ``\emph{continuous wave}'' appears two times and that there are 58 bigrams in a 59 token corpus. $P( ext{pulsed laser})=0$ since "pulsed laser" never occurs in the corpus.
0.1
M1_preference_data_5
If process i fails, then eventually all processes j≠i fail Is the following true? If all processes j≠i fail, then process i has failed
['PNP']
0.1
M1_preference_data_6
Interpreting the results obtained throughout this homework, create a short text (max. 250 words) where you: Present and explain a credible causal diagram capturing the relationship between the variables below, and justify your causal diagram given the questions answered in this homework: "Skill": an individual's innat...
The set of states Q is the set of all possible maps q:A→N. Intuitively, each state of the object assigns each account its balance.The initialization map q_0:A→N assigns the initial balance to each account. Operations and responses of the type are defined as O={transfer⁡(a,b,x):a,b∈A,x∈ N}∪{read⁡(a):a∈A} and R={ true, f...
0.1
M1_preference_data_7
Suppose you are using the Hedge algorithm to invest your money (in a good way) into $N$ different investments. Every day you see how well your investments go: for $i\in [N]$ you observe the change of each investment in percentages. For example, $\mbox{change(i) = 20\%}$ would mean that investment $i$ increased in valu...
This is a more difficult question than it seems because it actually depends on the representation choosen for the lexicon. If this representation allows to have several numeric fields associated to lexical entries, then definitly it should be stored there. Otherwise some external (I mean out of the lexicon) array woul...
0.1
M1_preference_data_8
You are discussing coding habits with a colleague, who says: "When I code, I only write some tests in order to get the minimum coverage my team wants." In one sentence, explain if this is a good habit and why:
the strings in the first column are canonical representations, while the strings in the second column are surface forms.
0.1
M1_preference_data_9
Now let $\xv$ be a random vector distributed according to the uniform distribution over the finite centered dataset $\xv_1, . . . , \xv_N$ from above. % Consider the problem of finding a unit vector, $\wv \in \R^D$, such that the random variable $\wv^ op \xx$ has \emph{maximal} variance. What does it mean for the data ...
False.
0.1
M1_preference_data_10
What is the function of processors in a reorder buffer?
The algorithm is as follows: \begin{center} \begin{boxedminipage}[t]{0.9\textwidth} \begin{enumerate} \item Construct a $2$-universal hash family $\mathcal{H}$ of hash functions $h: V \to \{0,1\}$. \\[1mm] As seen in class, we can construct such a family in time polynomial in $n$, and $\mathcal{H}$ will contain $O(n^2...
0.1
M1_preference_data_11
If several elements are ready in a reservation station, which one do you think should be selected? extbf{Very briefly} discuss the options.
Obama SLOP/1 Election returns document 3 Obama SLOP/2 Election returns documents 3 and T Obama SLOP/5 Election returns documents 3,1, and 2 Thus the values are X=1, x=2, and x=5 Obama = (4 : {1 - [3}, {2 - [6]}, {3 [2,17}, {4 - [1]}) Election = (4: {1 - [4)}, (2 - [1, 21), {3 - [3]}, {5 - [16,22, 51]})
0.1
M1_preference_data_12
Your team is discussing the following code: /** Uploads images to the cloud. */ public final class ImageUploader { public void upload(Image image) { /* … */ } private boolean canUpload(Image image) { /* … */ } } One of your colleagues points out that "upload" currently has some unexpected behavior regarding f...
Let $d_i$ be the estimate of the $i$-th copy of the algorithm and $\overline{d}$ be the median of $d_i$. We also define $X_i = 1$ if $d_i \geq 3d$ and zero otherwise. Moreover, $X = \sum_{i=1}^{t} X_i$. Since $\Pr[\hat{d} > 3d] \leq 0.47$, the expected number of answers that exceed $3d$ is $0.47t$. If the median is lar...
0.1
M1_preference_data_13
The data contains information about submissions to a prestigious machine learning conference called ICLR. Columns: year, paper, authors, ratings, decisions, institution, csranking, categories, authors_citations, authors_publications, authors_hindex, arxiv. The data is stored in a pandas.DataFrame format. Create anoth...
$$ \mathbf{K}_{i, j}:=k\left(\mathbf{x}_{i}, \mathbf{x}_{j}\right)=\left\langle\phi\left(\mathbf{x}_{i}\right), \phi\left(\mathbf{x}_{j}\right)\right\rangle_{\mathbb{R}^{H}}=\mathbf{\Phi} \boldsymbol{\Phi}^{\top} \in \mathbf{R}^{n \times n} $$
0.1
M1_preference_data_14
Recall the online bin-packing problem that we saw in Exercise Set $10$: We are given an unlimited number of bins, each of capacity $1$. We get a sequence of items one by one each having a size of at most $1$, and are required to place them into bins as we receive them. Our goal is to minimize the number of bins we use,...
not(a or b)
0.1
M1_preference_data_15
We have a collection of rectangles in a plane, whose sides are aligned with the coordinate axes. Each rectangle is represented by its lower left corner $(x_1,y_1)$ and its upper right corner $(x_2,y_2)$. All coordinates are of type Long. We require $x_1 \le x_2$ and $y_1 \le y_2$. Define a case class Rectangle storing ...
Whatever your personal convictions, you have to adapt to the convention used by the project.
0.1
M1_preference_data_16
It is often desirable to be able to express the performance of an NLP system in the form of one single number, which is not the case with Precision/Recall curves. Indicate what score can be used to convert a Precision/Recall performance into a unique number. Give the formula for the corresponding evaluation metric, and...
The benefit of depending on the latest available minor version means that we will always be up-to-date with the latest bugfixes and security/performance improvements as well. But the problem with this approach is that it could lead to unexpected behaviour which could cause bugs, because two compatible versions can stil...
0.1
M1_preference_data_17
The purpose of this first exercise part is to ensure that the predictions produced by minimizing the true $\phi$-risk are optimal. As for the $0-1$ loss, it can be shown that the true $\phi$-risk is minimized at a predictor $g^\star:\mathcal X o \R$ satisfying for all $\xv\in\mathcal X$: egin{align*} ...
Yes, it is possible. d1>d2: adding d3=”b” d2>d1: adding d3=”c”
0.1
M1_preference_data_18
In this problem we are going to investigate the linear programming relaxation of a classical scheduling problem. In the considered problem, we are given a set $M$ of $m$ machines and a set $J$ of $n$ jobs. Each job $j\in J$ has a processing time $p_j > 0$ and can be processed on a subset $N(j) \subseteq M$ of the machi...
['(80+1000-{a}-{b}+80)/1000']
0.1
M1_preference_data_19
Following the notation used in class, let us denote the set of terms by $T=\{k_i|i=1,...,m\}$, the set of documents by $D=\{d_j |j=1,...,n\}$, and let $d_i=(w_{1j},w_{2j},...,w_{mj})$. We are also given a query $q=(w_{1q},w_{2q},...,w_{mq})$. In the lecture we studied that, $sim(q,d_j) = \sum^m_{i=1} \frac{w_{ij}}{|...
1. I/O: Checked exception, can happen even if the code is correct due to external factors 2. Backend timeout: Checked exception, can happen even if the code is correct due to SwengPhotos internals 3. Name already exists: Unchecked exception, the library should deal with this internally and never make such an invalid re...
0.1
M1_preference_data_20
You are discussing coding habits with a colleague, who says: "When I edit a part of a function, if I see unclean code in another part of it, I also clean that other part up." In one sentence, explain if this is a good habit and why:
If the messages, on which the algorithm agrees in consensus, are never sorted deterministically within every batch (neither a priori, not a posteriori), then the total order property does not hold. Even if the processes decide on the same batch of messages, they might TO-deliver the messages within this batch in a diff...
0.1
M1_preference_data_21
Recall from the last lecture (see Section 16.1.1 in notes of Lecture~8) that the number of mistakes that Weighted Majority makes is at most $2(1+\epsilon) \cdot \mbox{(\# of $i$'s mistakes)} + O(\log N/\epsilon)$, where $i$ is any expert and $N$ is the number of experts. Give an example that shows that the factor $2$...
Returns a list of elements that appear exactly once in the input list, in a reverse order
0.1
M1_preference_data_22
Given the following code snippet, you are tasked to produce a modulo scheduled version of the loop achieving the best possible performance. You can assume that any operation has a latency of one cycle and that the processor has 2 ALUs, one memory unit, and one...
Consider the following linear program with a variable $p(v)$ for each vertex $v\in V$: \begin{align*} \textrm{max} \quad & \sum_{v\in V} p(v) \\ \textrm{subject to} \quad& \sum_{v\in S} p(v) \leq |E(S, \bar S)| \qquad \mbox{for all $\emptyset \subset S \subset V$} \\ & p(v) \geq 0 \qquad \mbox{for all $v\in V$} \end...
0.1
M1_preference_data_23
Only \( G \) different 4-grams (values) are indeed observed. What is the probability of the others:using “additive smoothing” with a Dirichlet prior with parameter \( (\alpha, \cdots, \alpha) \), of appropriate dimension, where \( \alpha \) is a real-number between 0 and 1?
We can view the threshold as an additional weight by adding the constant input $1$ to the input $\xv$. It amounts to consider the input $ ilde \xv^ op= [\xv^ op,1]$ since $ ilde \xv^ op [\wv^ op,b] = \xv^ op \wv + b$.
0.1
M1_preference_data_24
Remember that monoids can be represented by the following type class: 1 trait SemiGroup[T]: 2 extension (x: T) def combine (y: T): T 3 4 trait Monoid[T] extends SemiGroup[T]: 5 def unit: T Additionally the three following laws should hold for all Monoid[M] and all a, b, c: M: (Associativity) a.combine(b).combine(c) ===...
Here we give a detailed explanation of how to set the costs. Your solution does not need to contain such a detailed explanation. The idea of using the Hedge method for linear programming is to associate an expert with each constraint of the LP. In other words, the Hedge method will maintain a weight distribution over t...
0.1
M1_preference_data_25
Build the inverse document-frequency matrix (idf)
x => Math.min(a(x), b(x))
0.1
M1_preference_data_26
Given a joint data distribution $\mathcal D$ on $\mathcal X imes \{-1,1\}$ and $n$ independent and identically distributed observations from $\mathcal D$, the goal of the classification task is to learn a classifier $f:\mathcal X o \{-1,1\}$ with minimum true risk $\mathcal L(f) = \mathbb E_{(X,Y)\sim \mathcal D} [o...
Amazon Web Services (as can be found by looking up the error name)
0.1
M1_preference_data_27
You've been hired to modernize a codebase from a 50-year-old company: version control, automated builds, and continuous integration. One of your colleagues, who is not completely up-to-date with modern practices, asks you the following question: "Do I have to do one "commit" each day with my day's work?" What would be ...
The result of doing scanLeft1 and then reversing the answer is not the same as applying scanRight1 on the reversed input (unless $f$ is commutative) Consider once again our favourite sequence $A = (a_1, a_2)$. We apply the operations as required: $$rev(A).scanLeft1(f) = (a_2, f(a_2, a_1))$$ and $$rev(A.scanRight1(f))...
0.1
M1_preference_data_28
You just started an internship in an IT services company. Your first task is about maintaining an old version of a product still used by a large customer. A bug just got fixed in the latest version of the product, and you must fix it in the old version. You ask where the source code is, and a developer shows you a repo...
" Compute confidence for a given set of rules and their respective support freqSet : frequent itemset of N-element H : list of candidate elements Y1, Y2... that are part of the frequent itemset supportData : dictionary storing itemsets support rules : array to store rules min_confidence...
0.1
M1_preference_data_29
In a game of Othello (also known as Reversi in French-speaking countries), when a player puts a token on a square of the board, we have to look in all directions around that square to find which squares should be “flipped” (i.e., be stolen from the opponent). We implement this in a method computeFlips, taking the posit...
Neither
0.1
M1_preference_data_30
Consider the Poisson distribution with parameter $\lambda$. It has a probability mass function given by $p(i)=\frac{\lambda^{i} e^{-\lambda}}{i !}$, $i=0,1, \cdots$ (i) Write $p(i)$ in the form of an exponential distribution $p(i)=h(i) e^{\eta \phi(i)-A(\eta)}$. Explicitly specify $h, \eta, \phi$, and $A(\eta)$ (ii) Co...
Since FloodSet guarantees that all non-faulty processes obtain the same W after f+1 rounds, other decision rules would also work correctly, as long as all the processes apply the same rule.
0.1
M1_preference_data_31
One of your colleagues has recently taken over responsibility for a legacy codebase, a library currently used by some of your customers. Before making functional changes, your colleague found a bug caused by incorrect use of the following method in the codebase: public class User { /** Indicates whether the user’s...
causal language modeling learns to predict the next word, which you would need to generate a story.
0.1
M1_preference_data_32
Consider the following CFG \(\text{S} \rightarrow \text{NP VP PNP}\) \(\text{NP} \rightarrow \text{Det N}\) \(\text{NP} \rightarrow \text{Det Adj N}\) \(\text{VP} \rightarrow \text{V}\) \(\text{VP} \rightarrow \text{Aux Ving}\) \(\text{VP} \rightarrow \text{VP NP}\) \(\text{VP} \rightarrow \text{VP PNP}\) \(\text{PNP}...
We give a rounding algorithm that gives a cut $x^*$ (an integral vector) of expected value equal to the value of an optimal solution $x$ to the quadratic program. The rounding algorithm is the basic one: set $x^*_i = 1$ with probability $x_i$ and $x^*_i = 0$ with probability $1 - x_i$. The expected value of the objec...
0.1
M1_preference_data_33
Implement Item-based collaborative filtering using the following formula: \begin{equation} {r}_{x}(a) = \frac{\sum\limits_{b \in N_{I}(a)} sim(a, b) r_{x}(b)}{\sum\limits_{b \in N_{I}(a)}|sim(a, b)|} \end{equation} You will create a function that takes as input the ratings and the similarity matrix and gives as outp...
Recall the definition of pairwise independence: for any non-empty $S$ and $T$ such that $S\neq T$ and two bits $b_S$ and $b_T$, we have \begin{align*} \Pr[X_S= b_S \wedge X_T = b_T] = 1/4\,. \end{align*} We now first argue that $\mathbb{E}[X_S] = 1/2, \mathbb{E}[X_T] = 1/2$ and $\mathbb{E}[X_S X_T] = 1/4$ implies that...
0.1
M1_preference_data_34
Implement Latent Semantic Indexing by selecting the first x largest singular values of the term document matrix Hint 1: np.linalg.svd(M, full_matrices=False) performs SVD on the matrix $\mathbf{M}$ and returns $\mathbf{K}, \mathbf{S}, \mathbf{D}^T$ - $\mathbf{K}, \mathbf{D}^T$ are matrices with orthonormal column...
We have a variable $x_1$ for moitie moitie, a variable $x_2$ for a la tomate, and a variable $x_3$ for Raclette. The linear program becomes \begin{align*} \text{Minimize} \quad &50 x_1 + 75 x_2 + 60 x_3\\ \text{Subject to} \quad &35 x_1 + 0.5 x_2 + 0. 5x_3 \geq 0.5 \\ &60 x_1 + 300 x_2 + 0. 5x_3 \geq 15 \\ &30 ...
0.1
M1_preference_data_35
In class, we saw Karger's beautiful randomized algorithm for finding a minimum cut in an undirected graph $G=(V,E)$. Recall that his algorithm works by repeatedly contracting a randomly selected edge until the graph only consists of two vertices which define the returned cut. For general graphs, we showed that the retu...
Any terminating exception. 1. Memory protection violation. 2. Memory fault.
0.1
M1_preference_data_36
What happens in the reliable broadcast algorithm if the accuracy property of the failure detector is violated?
Using Claim 7 and Corollary 8 from the Lecture 7 notes, the expected cost of collection $C$ after $d$ executions of Step 3 of the algorithm for set cover given in Lecture 7 notes is at most $d \cdot LP_{OPT}$. Let $X_i$ be a random variable corresponding to the event whether i-th element is covered by the output $C$ or...
0.1
M1_preference_data_37
In this week's lecture, you have been introduced to the aggregate method of ParSeq[A] (and other parallel data structures). It has the following signature: def aggregate[B](z: B)(f: (B, A) => B, g: (B, B) => B): B Discuss, as a group, what aggregate does and what its arguments represent. Consider the parallel sequence...
The result of scanRight1 is not the same as scanLeft1 on the reversed sequence either. Consider the same example as the previous case, but reverse the argument of scanLeft1. We have $$rev(A).scanLeft1(f) = (a_2, f(a_2, a_1))$$ but $$A.scanRight1(f) = (f(a_1, a_2), a_2)$$ With the choice of $f(x, y) := x$, we get $$re...
0.1
M1_preference_data_38
Given the following classes: • class Pair[+U, +V] • class Iterable[+U] • class Map[U, +V] extends Iterable[Pair[U, V]] Recall that + means covariance, - means contravariance and no annotation means invariance (i.e. neither covariance nor contravariance). Consider also the following typing relationships for A, B, X, and...
def cosine_similarity(v1,v2): """ It computes cosine similarity. :param v1: list of floats, with the vector of a document. :param v2: list of floats, with the vector of a document. :return: float """ sumxx, sumxy, sumyy = 0, 0, 0 for i in range(len(v1)): x = v1[i]; y = v2[i]...
0.1
M1_preference_data_39
The goal of the 4 following questions is to prove that the methods map and mapTr are equivalent. The former is the version seen in class and is specified by the lemmas MapNil and MapCons. The later version is a tail-recursive version and is specified by the lemmas MapTrNil and MapTrCons. All lemmas on this page hold fo...
Continous integration should be set up for the main branch, to reduce the likelihood of bugs in the final product.
0.1
M1_preference_data_40
Assume you work in a team that is developing a weather application that brings together data from several sources. One of your colleagues is responsible for creating a client for a weather service that returns data in JSON format. Your colleague suggests creating a weather client interface that returns the weather as a...
We convince our friend by taking $y_1\geq 0$ multiples of the first constraints and $y_2\geq 0$ multiplies of the second constraint so that \begin{align*} 6 x_1 + 14 x_2 + 13 x_3 \leq y_1 ( x_1 + 3x_2 + x_3 ) + y_2 (x_1 + 2x_2 + 4 x_3) \leq y_1 24 + y_2 60\,. \end{align*} To get the best upper bound, we wish to minimi...
0.1
M1_preference_data_41
Consider the following case class definitions: case class Node(id: Int) case class Edge(from: Node, to: Node) Let us represent a directed graph G as the list of all its edges (of type List[Edge]). We are interested in computing the set of all nodes reachable in exactly n steps from a set of initial nodes. Write a reach...
The transducer T1 is built by using the standard operators (concatenation, disjunction and cross-product) and regular expressions available for the transducers. For instance: T1 = ([a-z]+) ((\+V\+IndPres\+) x (\+)) (((([12]s) | ([123]p)) x (2)) | ((3s) x (1)) )
0.1
M1_preference_data_42
Design a polynomial-time algorithm for the matroid matching problem: \begin{description} \item[Input:] A bipartite graph $G=(A \cup B, E)$ and two matroids $\mathcal{M}_A = (A, \mathcal{I}_A)$, $\mathcal{M}_B = (B, \mathcal{I}_B)$. \item[Output:] A matching $M \subseteq E$ of maximum cardinality satisfying: \begin{enum...
Let us compute the derivative wrt a particular user $u^{\prime}$ and set it to 0 . We get $$ \sum_{u^{\prime} \sim m}\left(f_{u^{\prime} m}-r_{u^{\prime} m}\right)+\lambda b_{u^{\prime}}=0 $$ Note that the $f_{u^{\prime} m}$ contains the $b_{u^{\prime}}$. Solving this equation for $b_{u^{\prime}}$ we get $$ b_{u^{\prim...
0.1
M1_preference_data_43
Assume you are working on a mobile application. You meet a client while out for coffee, who tells you: "I noticed it's not possible to customize the profile picture. I know you have a lot of stuff to do this sprint, but my boss is threatening to switch to another app, could you get this fixed during this sprint?" In on...
No, it's not, you have to potentially write a lot of statements that you'll need to manually remove. Using a debugger, your friend could add breakpoints that prints the values, and can change them on the fly.
0.1
M1_preference_data_44
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service: "Currently, the user types in the topic they want to see images for, and the client app sends a request to ...
alloc is used to give fresh registers to each routine without having to push explicitly values on the stack (and popping them back prior to a return). It is usually placed at the beginning of each routine. The first parameter indicates how many values wil...
0.1
M1_preference_data_45
We have a collection of rectangles in a plane, whose sides are aligned with the coordinate axes. Each rectangle is represented by its lower left corner $(x_1,y_1)$ and its upper right corner $(x_2,y_2)$. All coordinates are of type Long. We require $x_1 \le x_2$ and $y_1 \le y_2$. Define an operation hull2 that takes t...
semantic ambiguity (two different meanings, polysemy, homonymy(homography)). Word Sense Disambiguation (WSD) through the information from the context (e.g. coehsion).
0.1
M1_preference_data_46
We consider now the ridge regression problem: $$ \min _{\mathbf{w} \in \mathbb{R}^{d}} \frac{1}{2 N} \sum_{n=1}^{N}\left[y_{n}-\mathbf{x}_{n}^{\top} \mathbf{w}\right]^{2}+\lambda\|\mathbf{w}\|_{2}^{2}, $$ where the data $\left\{\left(\mathbf{x}_{n}, y_{n}\right)\right\}_{n=1}^{N}$ are such that the feature vector $\mat...
1. Predicates are 1-bit registers associated with instruction. If the predicate is true, the instruction commits the result to the register file; if it is false, the result is dropped. 2. It allows to execute both sides of a branch and, when there are enough available resources, ...
0.1
M1_preference_data_47
If process i fails, then eventually all processes j≠i fail Is the following true? If some process j≠i does not fail, then process i has not failed
Simply use that if $g(\xv)g^\star(\xv)<0$ we get that $|2\eta(\xv)-1)|\leq |2\eta(\xv)-1-b(g(\xv))|$ Indeed either $\eta(\xv)>1/2$ and $g(\xv)<0$ and thus $b(g(\xv))<0$, or $\eta(\xv)<1/2$ and $g(\xv)>0$ and thus $b(g(\xv))>0$, where we have used that $b$ preserves signs.
0.1
M1_preference_data_48
Homer, Marge, and Lisa Simpson have decided to go for a hike in the beautiful Swiss Alps. Homer has greatly surpassed Marge's expectations and carefully prepared to bring $n$ items whose total size equals the capacity of his and his wife Marge's two knapsacks. Lisa does not carry a knapsack due to her young age. More ...
# adding album number two_ormore.loc[:,'album_number'] = (two_ormore .sort_values(by=['releaseyear', 'reviewdate']) .groupby('artist')['album'] .transform(lambda x : range(len(x)))) # example artist: two_ormore.sort_values(by=['r...
0.1
M1_preference_data_49
You have been hired to evaluate an email monitoring system aimed at detecting potential security issues. The targeted goal of the application is to decide whether a given email should be further reviewed or not. You have been given the results of three different systems that have been evaluated on the same panel of 157...
As evident from the confusion matrix, the disparity in class proportions does indeed hurt the model. Almost all (99%) of the examples are classified as class 0. What's more, 75% of the articles in class 1, are predicted to belong to class 0. One way to address this is to employ cost-sensitive learning, i.e., using cla...
0.1
M1_preference_data_50
What is the problem addressed by a Part-of-Speech (PoS) tagger? Why isn't it trivial? What are the two main difficulties?
['answer should fit the regular expression: 10^8 + 10^15', 'answer should fit the regular expression: (10\\^8|10\\^\\{8\\}|10\\^(8)|10⁸) ?\\+ ?(10\\^15|10\\^\\{15\\}|10\\^(15)|10¹⁵)', 'answer should fit the regular expression: (10\\^15|10\\^\\{15\\}|10\\^(15)|10¹⁵) ?\\+ ?(10\\^8|10\\^\\{8\\}|10\\^(8)|10⁸)']
0.1
M1_preference_data_51
If process i fails, then eventually all processes j≠i fail Is the following true? If no process j≠i fails, nothing can be said about process i
You could change the interface such that all 9 images are batched together, this reduces the communication.
0.1
M1_preference_data_52
In an automated email router of a company, we want to make the distinction between three kind of emails: technical (about computers), financial, and the rest ('irrelevant'). For this we plan to use a Naive Bayes approach. What is the main assumption made by Naive Bayes classifiers? Why is it 'Naive'? We will consider ...
False
0.1
M1_preference_data_53
From a corpus of \( N \) occurences of \( m \) different tokens:How many different 4-grams (values) could you possibly have?
x => if s(x) then 1 else 0
0.1
M1_preference_data_54
A company active in automatic recognition of hand-written documents needs to improve the quality of their recognizer. This recognizer produces sets of sequences of correct English words, but some of the produced sequences do not make any sense. For instance the processing of a given hand-written input can produce a set...
Average degree is not recommended as the degree distribution of real-world networks usually follows a powerlaw. Summarizing powerlaws with average values is not a good idea, as there is a long tail, and there are many nodes that have very high degree. Instead, median is a better choice.
0.1
M1_preference_data_55
What is modulo scheduling and what are its benefits? What does it apply to? What is its goal? In which respect is it superior to simpler techniques with the same goal?
First, let us simplify the situation a little by noticing that with probability $1$, all elements $h(i)$ for $i \in U$ are different. This is because $\Pr[h(i) = h(j)] = 0$ for $i \ne j$ (recall that each $h(i)$ is uniform on the interval $[0,1]$). Given this, let us see where $\min_{i \in A \cup B} h(i)$ is attained: ...
0.1
M1_preference_data_56
Assume you are writing server-side code for an online shop. The code will be invoked over HTTP from a mobile app. Your current code is as follows: public class ShoppingCart { public void buy(Product product, int quantity) { if (product == null) { throw new IllegalArgumentException("product cannot be null");...
Any NLP application that requires the assessment of the semantic proximity between textual entities (text, segments, words, ...) might benefit from the semantic vectorial representation. Information retrieval is of course one of the prototypical applications illustrating the potentiality of the VS techniques. However, ...
0.1
M1_preference_data_57
Given a document collection with a vocabulary consisting of three words, $V = {a,b,c}$, and two documents $d_1$ = aabc and $d_2 = abc$. The query is $q = ab$. Using smoothed probabilistic retrieval (with $\lambda=0.5$), is it possible to enforce both a ranking $d_1 > d_2$ and $d_2 > d_1$ by adding suitable documents t...
1. Rotating registers: A register file with a hardware managed offset added to the querying addresses, to rename registers automatically across loop iterations. 2. (Rotating) predicates: to enable only the active stages of the l...
0.1
M1_preference_data_58
Assume you decide to contribute to an open source project, by adding a feature to an existing class of the project. The class uses an underscore at the beginning of names then "camelCase" for private properties such as "_likeThis", but you find this odd because you're used to the "snake case" "like_this". Which option ...
from sklearn.metrics import mean_squared_error from math import sqrt def rmse(prediction, ground_truth): prediction = prediction[ground_truth.nonzero()].flatten() ground_truth = ground_truth[ground_truth.nonzero()].flatten() return sqrt(mean_squared_error(prediction, ground_truth))
0.1
M1_preference_data_59
For this homework you will use a dataset of 18,403 music reviews scraped from Pitchfork¹, including relevant metadata such as review author, review date, record release year, review score, and genre, along with the respective album's audio features pulled from Spotify's API. The data consists of the following columns: ...
$ ext{Var}[\wv^ op \xx] = rac1N \sum_{n=1}^N (\wv^ op \xx_n)^2$ %
0.1
M1_preference_data_60
Implement RSME score based on the following formula. \begin{equation} \mathit{RMSE} =\sqrt{\frac{1}{N} \sum_i (r_i -\hat{r_i})^2} \end{equation} You can use the mean_squared_error function from sklearn.metrics.
Every process uses TRB to broadcast its proposal. Let p be any process, eventually every correct process either delivers p’s proposal or ⊥ (if p fails). Eventually, every correct process has the same set of proposals (at least one is not ⊥, since not every process crashes). Processes use a shared but arbitrary function...
0.1
M1_preference_data_61
Give some arguments justifying why evaluation is especially important for NLP. In particular, explain the role of evaluation when a corpus-based approach is used.
If you do not get an accuracy of at least 90 percent then you are not really doing anything since you can get ten percent by simply always outputting 0.
0.1
M1_preference_data_62
Following the notation used in class, let us denote the set of terms by $T=\{k_i|i=1,...,m\}$, the set of documents by $D=\{d_j |j=1,...,n\}$, and let $d_i=(w_{1j},w_{2j},...,w_{mj})$. We are also given a query $q=(w_{1q},w_{2q},...,w_{mq})$. In the lecture we studied that, $sim(q,d_j) = \sum^m_{i=1} \frac{w_{ij}}{|...
Total order property: Let m1 and m2 be any two messages and suppose p and q are any two correct processes that deliver m1 and m2. If p delivers m1 before m2, then q delivers m1 before m2. This allows a scenario where faulty process p broadcasts messages 1, 2, 3, and correct processes a, b, c behave as follows: - Proces...
0.1
M1_preference_data_63
In this problem, we consider a generalization of the min-cost perfect matching problem. The generalization is called the \emph{min-cost perfect $b$-matching problem} and is defined as follows: \begin{description} \item[Input:] A graph $G = (V,E)$ with edge costs $c: E \rightarrow \mathbb{R}$ and degree bounds $b: V \ri...
def communities_modularity(G, nodes_community): ''' input: G:nx.Graph nodes_community:{node_id:community_id} output: Q (modularity metric) ''' Q = 0 m = len(G.edges) for node_i in G.nodes: for node_j in G.nodes: if nodes_community[node_i] == nodes_comm...
0.1
M1_preference_data_64
You have been publishing a daily column for the Gazette over the last few years and have recently reached a milestone --- your 1000th column! Realizing you'd like to go skiing more often, you decide it might be easier to automate your job by training a story generation system on the columns you've already written. Then...
As a visually impaired user, I want my reading assistant to be able to read the jokes out loud, so that I can make my friends laugh.
0.1
M1_preference_data_65
The purpose of this first exercise part is to ensure that the predictions produced by minimizing the true $\phi$-risk are optimal. As for the $0-1$ loss, it can be shown that the true $\phi$-risk is minimized at a predictor $g^\star:\mathcal X o \R$ satisfying for all $\xv\in\mathcal X$: Let $b: \R o \R$ a f...
1. Continuous integration, even paired with tests, cannot guarantee the code "never has bugs" 2. Feature branches should be allowed to fail tests, otherwise developers will not commit enough and risk losing data
0.1
M1_preference_data_66
Assume that you are part of a team developing a mobile app using Scrum. When using the app, you identified multiple bugs and features which you think should be implemented, and took some notes. You want to share these with the Product Owner. Your backlog of tasks includes the following task: - [ ] As a registered user,...
The load should become an advanced load and there must be a exttt{chk.a} instruction right after the store to exttt{r3}; the recovery code consists of the load simply repeated and of the incrementation of exttt{r1} also repeated.
0.1
M1_preference_data_67
List two common types of exceptions which must be implemented precisely. Explain why.
Given a total-order broadcast primitive TO, a consensus abstraction is obtained as follows: upon init do decided := false end upon propose(v) do TO-broadcast(v) end upon TO-deliver(v) do if not decided then decided := true decide(v) end end When a process proposes a value v in consensus, it TO-broadcasts v. When the ...
0.1
M1_preference_data_68
In which class of processors do you expect to find reservation stations?
Firstly, the destination address of the load itself and of all the preceding stores must be known. Secondly, there should be no collision with one of the store addresses (and in this case the load can be sent to memory) or, if there is any, the data for the latest colliding store must b...
0.1
M1_preference_data_69
Consider an HMM Part-of-Speech tagger, the tagset of which contains, among others: DET, N, V, ADV and ADJ, and some of the parameters of which are: $$ \begin{gathered} P_{1}(\mathrm{a} \mid \mathrm{DET})=0.1, \quad P_{1}(\text {accurately} \mid \mathrm{ADV})=0.1, \quad P_{1}(\text {computer} \mid \mathrm{N})=0.1, \\ P...
We prove that all the extreme points are integral by contradiction. To that end, assume that there exists an extreme point $x^*$ that is not integral. Let $G=(V_1,V_2,E)$ be the given bipartite graph and let $E_f= \{e \in E \text{ }|\text{ } 0 < x_e^* < 1\}$. If $E_f$ contains a cycle, then the proof follows in the sam...
0.1
M1_preference_data_70
Assume you're working for a startup that develops a university management app. You just received a description of what the app should do: > This app will be the administrative backbone of the university. > Almost all staff will use it. > Human Resources will register each student, including their personal details, and...
['1']
0.1
M1_preference_data_71
Let $A \in \mathbb{R}^{m\times n}$, $b\in \mathbb{R}^m$ and $c\in \mathbb{R}^n$. Consider the following linear program with $n$ variables: \begin{align*} \textbf{maximize} \hspace{0.8cm} & c^Tx \\ \textbf{subject to}\hspace{0.8cm} & Ax =b \\ \hspace{0.8cm} & x \geq 0 \end{align*} Show that any extreme point $x^*$ has a...
We assume that we cannot directly compute $\phi(\mathbf{x})$. The complexity would be too high. Instead, we will now apply the kernel trick to this problem:
0.1
M1_preference_data_72
What is the formal relation between accuracy and the error rate? In which case would you recommend to use the one or the other?
This is a compatibility break, the method should be deprecated instead and removed in some future release after it has been deprecated for some time.
0.1
M1_preference_data_73
Consider the following contains function defined on Iterable (in particular, it accepts both Vector and List). def contains[A](l: Iterable[A], elem: A): Boolean = val n = l.size if n <= 5 then for i <- l do if i == elem then return true false else val (p0, p1) = parallel( contains...
Let $y$ be an optimal dual solution. By complementary slackness we have that for each set $S$, either $x^*_s = 0$ or $\sum_{e\in S} y_e = c(S)$. Let us now compute the cost of our algorithm. The cost of the algorithm is $\sum_{S:x^*_S > 0} c(S)$. By complementarity slackness we get that \[ \sum_{S:x^*_S > 0} c(S) = \su...
0.1
M1_preference_data_74
Prove that if a^2 is even, a is even.
The colleague should start off by profiling first. He might have an idea to improve the performance of a component of the app, but it might not be the performance bottleneck. Thus, the end user won't notice any improvement.
0.1
M1_preference_data_75
In the following problem Alice holds a string $x = \langle x_1, x_2, \ldots, x_n \rangle$ and Bob holds a string $y = \langle y_1, y_2, \ldots, y_n\rangle$. Both strings are of length $n$ and $x_i, y_i \in \{1,2,\ldots, n\}$ for $i=1,2, \ldots, n$. The goal is for Alice and Bob to use little communication to estimate ...
The algorithm is as follows: \begin{itemize} \item If $x_1 \geq W$, then do the exchange on day $1$ and receive $x_1$ Swiss francs. \item Otherwise, do the exchange on day $2$ and receive $x_2$ Swiss francs. \end{itemize} We now analyze its competitiveness. If $x_1 \geq W$, then our algorithm gets at least $W$ Swiss fr...
0.1
M1_preference_data_76
You have just started your prestigious and important job as the Swiss Cheese Minister. As it turns out, different fondues and raclettes have different nutritional values and different prices: \begin{center} \begin{tabular}{|l|l|l|l||l|} \hline Food & Fondue moitie moitie & Fondue a la tomate & Raclette & Requirement pe...
1. The adjacency graph has ones everywhere except for (i) no edges between exttt{sum} and exttt{i}, and between exttt{sum} and exttt{y\_coord}, and (ii) five on the edge between exttt{x\_coord} and exttt{y\_coord}, and two on the edge...
0.1
M1_preference_data_77
Your colleague wants your opinion on a module design question. They are developing a service that recommends hikes near users based on the weather, and they think the module should take as input a weather service, a service that lists hikes, a function that sorts hikes by length, and outputs an array of hikes. What do ...
def compute_precision_at_k(retrieved_tweets, gt, k=5): """ It computes the precision score at a defined set of retrieved documents (k). :param predict: list of predictions :param gt: list of actual relevant data :param k: int :return: float, the precision at a given k """ results = ...
0.1
M1_preference_data_78
Implement the function `check_words` that checks if the words of a strings have common words with a list. Write your code in python. Your code should be agnostic to lower/upper case.
df["authors_publications_last"] = df["authors_publications"].apply(lambda a:int(str(a).split(";")[-1])) df["authors_citations_last"] = df["authors_citations"].apply(lambda a: int(str(a).split(";")[-1])) df["reputation"] = np.log10(df["authors_citations_last"]/df["authors_publications_last"] + 1)
0.1
M1_preference_data_79
Consider the following matrix-factorization problem. For the observed ratings $r_{u m}$ for a given pair $(u, m)$ of a user $u$ and a movie $m$, one typically tries to estimate the score by $$ f_{u m}=\left\langle\mathbf{v}_{u}, \mathbf{w}_{m}\right\rangle+b_{u}+b_{m} $$ Here $\mathbf{v}_{u}$ and $\mathbf{w}_{m}$ are v...
Using meta data of the movie as additional information to encode the similarity, perhaps approximating the corresponding weight as a linear combination of existing movies based on their similarities in terms of meta information.
0.1
M1_preference_data_80
We have a collection of rectangles in a plane, whose sides are aligned with the coordinate axes. Each rectangle is represented by its lower left corner $(x_1,y_1)$ and its upper right corner $(x_2,y_2)$. All coordinates are of type Long. We require $x_1 \le x_2$ and $y_1 \le y_2$. How can the result be computed in para...
Suppose that completeness is violated. Then, the processes might not be relaying messages they should be relaying. This may violate agreement. For instance, assume that only a single process p1 BEB-delivers (hence RB-delivers) a message m from a crashed process p2. If a failure detector (at p1) does not ever suspect p2...
0.1
M1_preference_data_81
Consider the following snippet used to produce a high-performance circuit using a statically scheduled HLS tool, such as Xilinx Vivado HLS. Assume that a erb+double+ multiplication takes several cycles (latency) to compute. egin{verbatim}...
Noticing that $80 \cdot 2=20 \cdot 8$, only the first three enter the game, among which the first is clerarly the best. The output will thus be a (DET) computer (N) process (N) programs (N) accurately (ADV)
0.1
M1_preference_data_82
One of your colleagues has recently taken over responsibility for a legacy codebase, a library currently used by some of your customers. Before making functional changes, your colleague found a bug caused by incorrect use of the following method in the codebase: public class User { /** Indicates whether the user’s...
1. Modulo scheduling is a loop pipelining technique. It transforms a loop kernel in a way to expose maximum parallelism and minimize the loop initiation interval. 2. Compared to basic software pipelining, it does not need an explicit prolog...
0.1
M1_preference_data_83
You have been hired to evaluate an email monitoring system aimed at detecting potential security issues. The targeted goal of the application is to decide whether a given email should be further reviewed or not. Give four standard measures usually considered for the evaluation of such a system? Explain their meaning. B...
we still lack 5\%: 16 to 20 will provide it: 20 tokens altogether.
0.1
M1_preference_data_84
Consider two Information Retrieval systems S1 and S2 that produced the following outputs for the 4 reference queries q1, q2, q3, q4: S1: | referential: q1: d01 d02 d03 d04 dXX dXX dXX dXX | q1: d01 d02 d03 d04 q2: d06 dXX dXX dXX dXX | q2: d05 d06 q3: dXX d07 d09 ...
Proof sketch Show that $D(L) \leq D'(L)$ for all $1 \leq L$. Then, show that, for any $1 \leq L_1 \leq L_2$, we have $D'(L_1) \leq D'(L_2)$. This property can be shown by induction on $L_2$. Finally, let $n$ be such that $L \leq 2n < 2L$. We have that: $$\begin{align} D(L) &\leq D'(L) &\text{Proven earlier.} \\ &\l...
0.1
M1_preference_data_85
Why a data prefetcher could hinder a Prime+Probe cache attack? How can the attacker overcome this problem?
Call(N("exists"), Fun("y", Call(Call(N("less"), N("x")), N("y"))))
0.1
M1_preference_data_86
We aim at tagging English texts with 'Part-of-Speech' (PoS) tags. For this, we consider using the following model (partial picture): ...some picture... Explanation of (some) tags: \begin{center} \begin{tabular}{l|l|l|l} Tag & English expl. & Expl. française & Example(s) \\ \hline JJ & Adjective & adjectif & yellow \...
['NP']
0.1
M1_preference_data_87
Consider the following contains function defined on Iterable (in particular, it accepts both Vector and List). def contains[A](l: Iterable[A], elem: A): Boolean = val n = l.size if n <= 5 then for i <- l do if i == elem then return true false else val (p0, p1) = parallel( contains...
Real-world code typically has too many paths to feasibly cover, e.g., because there are too many "if" conditions, or potentially-infinite loops.
0.1
M1_preference_data_88
/True or false:/ Is the following statement true or false? Justify your answer. "The node with the highest clustering coefficient in an undirected graph is the node that belongs to the largest number of triangles."
True
0.1
M1_preference_data_89
Consider an undirected graph $G=(V,E)$ and let $s\neq t\in V$. Recall that in the min $s,t$-cut problem, we wish to find a set $S\subseteq V$ such that $s\in S$, $t\not \in S$ and the number of edges crossing the cut is minimized. Show that the optimal value of the following linear program equals the number of edges c...
(a) err = 1 - acc. (b) does not make any sense: they are the same (opposite, actually)
0.1
M1_preference_data_90
What is your take on the accuracy obtained in an unballanced dataset? Do you think accuracy is the correct evaluation metric for this task? If yes, justify! If not, why not, and what else can be used?
1. In general, no. Speculative execution needs the ability to rollback wrongly executed instructions and VLIW typically miss appropriate data structures for this. 2, In specific cases, processors may implement mechanisms to implement speculatively instructions (e.g., by not raising ...
0.1
M1_preference_data_91
Consider the following toy learning corpus of 59 tokens (using a tokenizer that splits on whitespaces and punctuation), out of a possible vocabulary of $N=100$ different tokens: Pulsed operation of lasers refers to any laser not classified as continuous wave, so that the optical power appears in pulses of some duration...
It can be simply a test followed by a load at an arbitrary address (an array access protected by the test) and an indirect access based on the result of that access.
0.1
M1_preference_data_92
In the context of Load Store Queue, What conditions must be satisfied in the LSQ for a load to be executed and the result to be returned to the processor?
} (a) The log-likelihood is $$ \begin{aligned} \mathcal{L} & =\left(\sum_{n=1}^{N}\left(y_{n} \log (\theta)-\theta-\log y_{n} !\right)\right. \\ & =\log (\theta) \sum_{n=1}^{N} y_{n}-N \theta-\log \left(\prod_{n=1}^{N} y_{i} !\right) \end{aligned} $$ (b) Taking the derivative with respect to $\theta$, setting the resul...
0.1
M1_preference_data_93
Can we devise a Best-effort Broadcast algorithm that satisfies the causal delivery property, without being a causal broadcast algorithm, i.e., without satisfying the agreement property of a reliable broadcast?
If there are two experts, then the Weighted Majority strategy boils down to following the prediction of the expert who was wrong fewer times in the past. Assume a deterministic implementation of this strategy -- i.e., if the two experts are tied, then listen to the first one. Our example will consist of (arbitrarily ma...
0.1
M1_preference_data_94
The MIPS R10000 fetches four instructions at once and, therefore, there are four such circuits working in parallel inside the processor. What is the function of the ``Old dest'' field in the ``Active List''? And what is the function of ``Log dest''? Why are they needed in the ``Active list''?
The model could generate text that suggests treatments to users. As the model is not a medical professional, these treatments could cause harm to the user if followed. The model could also give wrong addresses to testing sites, causing users to be harmed. Others are acceptable.
0.1
M1_preference_data_95
Suppose we use the Simplex method to solve the following linear program: \begin{align*} \textbf{maximize} \hspace{0.8cm} & 2x_1 - x_2 \\ \textbf{subject to}\hspace{0.8cm} & x_1 - x_2 + s_1 = 1 \\ \hspace{0.8cm} & \hspace{0.85cm}x_1 + s_2 = 4 \\ \hspace{0.8cm} & \hspace{0.85cm} x_2 + s_3 = 2 \\ \hspace{0.8cm} &\hsp...
The function contains will create contiguous sub-arrays of less than 5 elements of the array. The work is the total sum of all the work done by every parallel task. A task either splits the array or processes it sequentially. Since splitting is done in $\Theta(1)$ and every element is going to be processed sequentially...
0.1
M1_preference_data_96
What does it mean that a processor supports precise exceptions?
Let $\phi_{1}(\cdot)$ be the feature map corresponding to $\kappa_{1}(\cdot, \cdot)$. Then by direct inspection we see that $\phi(\cdot)=\phi_{1}(f(\cdot))$ is the feature map corresponding to $\kappa(f(\cdot), f(\cdot))$. Indeed, $$ \phi_{1}(f(\mathbf{x}))^{\top} \phi_{1}\left(f\left(\mathbf{x}^{\prime}\right)\right)=...
0.1
M1_preference_data_97
Consider an IR engine, which uses an indexing mechanism implementing the following 3 consecutive filters: a morpho-syntactic filter that restricts indexing term candidates to only nouns, and reduces them to their root forms; a frequencial filter parameterized with \(f_\text{min}=0.06\) (resp. \(f_\text{max}=0.20\)) as...
['N']
0.1
M1_preference_data_98
Consider the following SCFG with the following probabilities: S → NP VP      0.8 S → NP VP PP      0.2 VP → Vi     {a1} VP → Vt NP     {a2} VP → VP PP         a NP → Det NN     0.3 NP → NP PP     0.7 PP → Prep NP    1.0 Vi → sleeps    1.0Vt → saw   1.0NN → man   {b1}NN → dog      bNN → telescope  ...
First, the output is always feasible since we always include all vertices with $x_i \geq 1/2$ which is a feasible vertex cover as seen in class. We proceed to analyze the approximation guarantee. Let $X_i$ be the indicator random variable that $i$ is in the output vertex cover. Then $\Pr[X_i = 1]$ is equal to the proba...
0.1
M1_preference_data_99
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
2