question stringlengths 19 3.53k | answer stringlengths 1 5.09k | label float64 0.1 0.1 | source stringlengths 20 22 |
|---|---|---|---|
Consider an operation we will call scanRight1 that, given a function $f$ of two arguments, and a sequence $a_1, \ldots, a_N$, computes a sequence $b_1, \ldots, b_N$ such that: $b_N = a_N$ $b_i = f(a_{i}, b_{i+1})$, for $0 < i < N$ Define similarly scanLeft1 in a manner similar to scanRight1: Given a function $f$ of t... | * Similarity - For retrieval, both approaches aim to measure the relevance between the query q and document $d_i$ by computing $P(q|d_i)$ * Diference - They are different in how $P(q|d)$ is computed. In the above, $P(q|d) = \sum_{i=1}^m P(k_i|d) P(q|k_i)$ while in the lecture $P(q|d) = \prod_{i=1}^m P(k_i|M_{d}) = \p... | 0.1 | M1_preference_data_200 |
What happens in the uniform reliable broadcast algorithm if the completeness property of the failure detector is violated? | 1. When one of the processor execution unit encounters an
instruction triggering an exception, it set the exception flag
of that instruction to true in the ROB.
2. When the processor tries to commit that instruction, it
checks whether the flag is set to true, and if it is, it
en... | 0.1 | M1_preference_data_201 |
Show that P is the weakest failure detector for Group Membership. | • accuracy / error rate / 'overall performance': number of correct/incorrect over total number ; adv: simple ; drawback: too simple, does not take unbalancing of classes into account
• Precision (for one class): number of correctly classified emails over number of emails classified in that class by the system ; Ignores... | 0.1 | M1_preference_data_202 |
Using the same set of transformations as in the previous question, what is the final value you get for the edit distance between execution and exceuton, i.e. D(execution, exceuton)?Give your answer as a numerical value. | 1. Prefetching, so that the next batch is ready by the time the user wants to see it
2. Caching, so that the photos do not need to be re-downloaded | 0.1 | M1_preference_data_203 |
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 ... | The fetch, decode, and rename stage proceed in program
order. They directly append in program order memory
instructions to the LSQ. | 0.1 | M1_preference_data_204 |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature,... | False. | 0.1 | M1_preference_data_205 |
Consider the following joint distribution that has the factorization $$ p\left(x_{1}, x_{2}, x_{3}, x_{4}, x_{5}\right)=p\left(x_{1}\right) p\left(x_{2} \mid x_{1}\right) p\left(x_{3} \mid x_{2}\right) p\left(x_{4} \mid x_{1}, x_{3}\right) p\left(x_{5} \mid x_{4}\right) . $$ : (4 points.) Determine whether the followin... | <: | 0.1 | M1_preference_data_206 |
Consider a bipartite graph $G=(V,E)$ where $V$ is partitioned into $A$ and $B$. Let $(A, \mathcal{I})$ be the matroid with ground set $A$ and \begin{align*} \mathcal{I} = \{ A' \subseteq A: \mbox{ $G$ has a matching in which every vertex of $A'$ is matched}\}\,. \end{align*} Recall that we say that a vertex is matched ... | Let us try to picture what the hashing function does. On the $i$-th coordinate, it partitions $\mathbb{R}$ into buckets of the form $..., [s_i - w, s_i), [s_i, s_i + w), [s_i + w, s_i + 2w), ...$, each of length $w$, with a random ``offset''. Given two numbers $p_i$ and $q_i$, the probability that they fall into the sa... | 0.1 | M1_preference_data_207 |
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... | We want to assign each job to a machine. For any job $j$ which the LP assigns to a single machine $i$, i.e., $x^*_{ij} = 1$, it clearly makes sense to listen to the LP and assign $j$ to $i$. To assign the other jobs, we will use the graph $H$, which has the following properties: \begin{itemize} \item $H$ is acyclic, i.... | 0.1 | M1_preference_data_208 |
Meltdown is a well-known attack on dynamically-scheduled
processors which exploits the fact that loads may be executed
speculatively before determining whether they represent a memory
access violation. Intel Itanium has a speculative load instruction
which... | Call(N("exists"), Fun("y", Call(Call(N("less"), N("y")), N("y")))) | 0.1 | M1_preference_data_209 |
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 failed | coumpond preprocessor is a wide topic in itself (lexical acquisition), but as in many NLP domains two main ways could be considered, which whould definitly be exploited in complement one of the other: the statistical way and the linguistic/human knowledge way.
The most naive linguistic approach could be to add by hand... | 0.1 | M1_preference_data_210 |
Assume In the process of reworking the architecture of the project, you need to remove a method because it's too easy to use incorrectly and there's now an easier-to-use replacement. What changes should you make for upcoming releases? | ['{t} * (1 + {t} + {w})', '({t} - 1) * (1 + {t}) + ({w} - 1) * {t}'] | 0.1 | M1_preference_data_211 |
Write the dual of the following linear program: \begin{align*} \text{Maximize} \quad &6x_1 + 14 x_2 + 13 x_3\\ \text{Subject to} \quad & x_1 + 3x_2 + x_3 \leq 24 \\ & x_1 + 2x_2 + 4 x_3 \leq 60 \\ & x_1, x_2, x_3 \geq 0 \end{align*} Hint: How can you convince your friend that the above linear program has optimum value... | The probability of contracting an edge in a fixed min-cut $C$ is much lower in the initial contractions (in Karger's algorithm) than at the end. Thus it makes sense to repeat the later contractions more times than the initial ones. This is the main idea of the Karger-Stein algorithm. Their implementation of this idea i... | 0.1 | M1_preference_data_212 |
Assume you are working on a school project with your friend.
Your friend claims that using very detailed names are good in code because they describe exactly what is going on. Do you agree? Explain in max 2 sentences. | Continuous integration can run code analysis and automated tests that developers wrote, but it does not create its own tests. | 0.1 | M1_preference_data_213 |
You are given a training set $S=\left\{\left(x_{n}, y_{n}\right)\right\}_{n=1}^{N}$ for classification with $y_{n} \in\{0,1\}$. Ninety percent of the labeled data has label 0. You split the data randomly into two equal parts, train on the first part, and then test on the second part. You get an accuracy of 85 percent. ... | The idea of the algorithm is to first decrease the variance by taking the average of $t = 10/\epsilon^2$ independent runs of \Alg. We then do the median trick. Formally, consider the algorithm $\mathcal{B}$ that runs $t$ independent copies of \Alg and then outputs the average of the $t$ estimates obtained from the inde... | 0.1 | M1_preference_data_214 |
The first annotator rated {a} reviews as positive and the rest as negative. The second annotator rated {b} reviews as positive and the rest as negative. 80 reviews were rated as positive by both annotators. Compute the quality of the above reference using Cohen's Kappa.Give your answer as a numerical value to three dec... | It's a (Determinitic) Finite-State Automaton on character pairs (cross-product of alphabets) It's the most efficient time-space implementation for matching two languages (cross-product of languages), which is the purpose of morphology. | 0.1 | M1_preference_data_215 |
Assume you are working on a mobile application. Users complain that your app's image gallery uses too much of their mobile data.
In one sentence, explain the first step towards improving this: | 0: ["mov LC, 10", "mov x51, 10000", nop, nop, nop]
1: ["mov EC, 1", "mov p40, true", nop, nop, nop]
2: ["(p40) addi x50, x51, 1", nop, nop, "(p40) ld x60, 0(x51)", nop]
3: ["(p40) addi x70, x60, 10", nop, nop, "(p41) st x71, 0(x52)", loop.pip 2]
... | 0.1 | M1_preference_data_216 |
Consider the task of classifying reviews as positive or negative. To create a reference for this task, two human annotators were asked to rate 1000 movie reviews as positive or negative.The first annotator rated {a} reviews as positive and the rest as negative. The second annotator rated {b} reviews as positive and the... | We consider an algorithm that uses an eventually perfect failure detector. By contradiction, we assume that the algorithm satisfies agreement, but not uniform agreement. We consider two executions A and B of the algorithm. In A, two processes π and ρ decide differently, and π crashes. Let t denote the time when ρ decid... | 0.1 | M1_preference_data_217 |
You are given the following accident and weather data. Each line corresponds to one event: 1. car_accident rain lightning wind clouds fire 2. fire clouds rain lightning wind 3. car_accident fire wind 4. clouds rain wind 5. lightning fire rain clouds 6. clouds wind car_accident 7. rain lightning clouds fire 8. lightnin... | F1, or any combination, e.g. weighted averages (Fβ ) | 0.1 | M1_preference_data_218 |
Consider the following problem where we are given an edge-colored graph and we wish to find a spanning tree that contains a specified number of edges of each color: \begin{description} \item[Input:] A connected undirected graph $G=(V,E)$ where the edges $E$ are partitioned into $k$ color classes $E_1, E_2, \dots, E_k$... | \begin{align} P(q|d_j) & = \frac{P(q \cap d_j)}{P(d_j)} \\ & = \sum_{i=1}^m \frac{P(q \cap d_j | k_i) P(k_i)}{P(d_j)} & \text{using $P(A) = \sum_B P(A|B) P(B)$} \\ & = \sum_{i=1}^m \frac{P(q|k_i) P(d_j | k_i) P(k_i)}{P(d_j)} & \text{using conditional independence} \\ & = \sum_{i=1}^m P(k_i |d_j) P(q|k_i) & \text{using ... | 0.1 | M1_preference_data_219 |
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... | >: | 0.1 | M1_preference_data_220 |
In this problem we design an LSH for points in $\mathbb{R}^d$ with the $\epsilonll_1$ distance, i.e. $$d(p,q) =\sum_{i=1}^d |p_i - q_i|.$$ Define a class of hash functions as follows: Fix a positive number $w$. Each hash function is defined via a choice of $d$ independently selected random real numbers $s_1,s_2,\dots,s... | This might lead to different results. | 0.1 | M1_preference_data_221 |
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'? | $P(q|d_1) = \sum_{i=1}^m P(k_i|d_1) P(q|k_i) = 0 \times \frac{1}{5} + \frac{1}{3} \times 0 + \frac{2}{3} \frac{2}{3} = \frac{4}{9} = 0.4444$ Similarly, for the remaining documents: + $P(q|d_2) = 1/15 = 0.0666$ + $P(q|d_3) = 11/30 = 0.3666$ + $P(q|d_4) = 3/20 = 0.15$. Thus the final ranking is $d_1, d_3, d_4, d_2$. | 0.1 | M1_preference_data_222 |
What does the following operation output for a given input list of numbers ?
1 def mystery5(ys: List[Int]) =
2 for y <- ys if y >= 0 && y <= 255 yield
3 val bits =
4 for z <- 7 to 0 by -1 yield
5 if ((1 << z) & y) != 0 then "1" else "0"
6 bits.foldRight("")((z, acc) => z + acc)
We have as an output... | Let $S_{\text {training }}=\{-1,0,1\}$. If our initial cluster assignments are $\{-1,0\}$ for cluster 1 and $\{1\}$ for cluster 2 then this itself is already a fixed point with cluster centroids -0.5 and 1 , respectively. But there is of course the "symmetric" fixed point with clusters $\{-1\}$ and $\{0,1\}$ that has c... | 0.1 | M1_preference_data_223 |
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 $v_b = 0$ for all $b\in B$ and $u_a = \min_{\{a,b\} \in E} c(\{a,b\})$ be a dual solution. By definition it is feasible. Now define the vector $(u^*, v^*)$ by \begin{align*} u^*_a = \begin{cases} 1 & \mbox{if $a\in S$}\\ 0 & \mbox{otherwise} \end{cases} \qquad \mbox{and} \qquad v^*_b = \begin{cases} -1 & \mbox{if ... | 0.1 | M1_preference_data_224 |
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}... | $P("continuous wave")=rac{2.01}{58+0.01 imes N^2}=rac{2.01}{158}$ where $N$ is the size of the (total possible) vocabulary.
$P("pulsed laser")=rac{0.01}{58+0.01 imes N^2}=rac{1}{15\,800}$ | 0.1 | M1_preference_data_225 |
Use Total Order Broadcast to implement an Asset Transfer sequential object. | Thus, when comparing the precision of the classifiers trained in two datasets, we conflate the challenges that may arise from data imbalance with the signal that we are trying to extract. The F-1 score is a better metric to handle data imbalance, as it combines precision with recall. | 0.1 | M1_preference_data_226 |
Given a matroid $\mathcal{M}= (E, \mathcal{I})$ and a weight function $w: E \rightarrow \mathbb{R}$,~\textsc{Greedy} for matroids returns a base $S = \{s_1, s_2, \dots, s_k\}$ of maximum weight. As noted in the lecture notes, any base consists of the same number, say $k$, of elements (which is said to be the rank o... | Notice that minimising $\mathcal{L}(\mathbf{z}, \boldsymbol{\mu})$ for given $\left\{\boldsymbol{\mu}_{k}\right\}_{k=1}^{K}$ reduces to minimizing $\sum_{k=1}^{K} z_{n k} \| \mathbf{x}_{n}-$ $\boldsymbol{\mu}_{k} \|_{2}^{2}$ for each $n \in\{1, \ldots, N\}$ independently. Notice that this sum is minimized for $z_{n k}=... | 0.1 | M1_preference_data_227 |
Consider the following code transformation:
egin{verbatim}
r3 = r3 << 4 r4 = r4 << 4
st [r3] = r2 ld r1 = [r4]
r5 = r3 + 4 r1 = r1 + 1... | def tails(ls: List[Int]): List[List[Int]] = ls :: (ls match { case x :: xs => tails(xs) case Nil => Nil }) | 0.1 | M1_preference_data_228 |
Review the notion of depth seen in the lecture. What does it represent? Below is a formula for the depth of a divide and conquer algorithm working on an array segment of size $L$, as a function of $L$. The values $c$, $d$ and $T$ are constants. We assume that $L>0$ and $T>0$. $$ D(L) = \begin{cases} c \cdot L &\text{... | concatenative morphology uses roots, prefixes and suffixes only. Exameples: in-cred-ible : in-: prefix, cred: root, -ible: suffix. concatenative morphology not relevant for all languages: more complex languages can involve infixes (e.g. Tagalog, Hebrew) or cirumfixes (e.g. German). Pattern-based morphology should then ... | 0.1 | M1_preference_data_229 |
Implement a reliable broadcast algorithm without using any failure detector, i.e., using only BestEffort-Broadcast(BEB). | No, the goal of tests is to increase confidence in the code's correctness, coverage is only a metric to evaluate tests and not the main goal | 0.1 | M1_preference_data_230 |
In the maximum directed cut problem we are given as input a directed graph $G = (V, A)$. Each arc $(i, j)\in A$ has a nonnegative weight $w_{ij} \geq 0$. The goal is to partition $V$ into two sets $U$ and $W = V \setminus U$ so as to maximize the total weight of the arcs going from $U$ to $W$ (that is, arcs $(i, j)$ w... | The Hessian of $f(v, w)$ is equal to
$$
\left(\begin{array}{cc}
2 w^{2} & 4 v w-2 r \\
4 v w-2 r & 2 v^{2}
\end{array}\right)
$$
This matrix is not positive semi-definite in general. Its determinant is equal to $-4(r-3 v w)(r-v w)$ which is not necessarily positive. Therefore the problem is only element-wise convex but... | 0.1 | M1_preference_data_231 |
Explain why any fail-noisy consensus algorithm (one that uses an eventually perfect failure detector ◇P) requires a majority of the processes to be correct. More precisely, provide a “bad run” in the case where the majority of processes is faulty. | system 2: error is first criterion, then for stastistically non signifiant differences in error (which is the case for system 1 and 2), then min std dev is better (especially with such big difference as here!) | 0.1 | M1_preference_data_232 |
Prove that √2 is irrational. | The current sprint backlog cannot be changed, the client should contact the Product Owner to plan the next sprint instead. | 0.1 | M1_preference_data_233 |
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... | When we want to prove something by contradiction, we start by assuming that the negation (of whatever we are trying to prove) is true. We said in the classroom that p → q is equivalent to ¬p ∨ q. Therefore the negation of p → q is p ∧¬q.
With that said, let's assume that a^2 is even and a is odd. Since a is odd, a can ... | 0.1 | M1_preference_data_234 |
For students born in April, how many months older are they than the average student in their grade? 5.4898 months
For students born in March, how many months younger are they than the average student in their grade? 5.5102 months
Discuss: Considering your common sense and the results obtained from the simulation: what... | Precision is prefered when very large amount of data are available and only a few well choosen one are enough: we want to have those very early, e.g. Web search Recall is prefered when have all the correct documents is important (implying that, if we want to handle them, they are not that many). Typically in legal situ... | 0.1 | M1_preference_data_235 |
Prove Hall's Theorem: \begin{itemize} \item[]``An $n$-by-$n$ bipartite graph $G=(A \cup B, E)$ has a perfect matching if and only if $|S| \leq |N(S)|$ for all $S\subseteq A$.'' \end{itemize} \emph{(Hint: use the properties of the augmenting path algorithm for the hard direction.)} | We could consider at least two approaches here: either binomial confidence interval or t-test. • binomial confidence interval: evaluation of a binary classifier (success or not) follow a binomial law with parameters (perror,T), where T is the test-set size (157 in the above question; is it big enough?). Using normal ap... | 0.1 | M1_preference_data_236 |
Let $\xv_1, . . . , \xv_N$ be a dataset of $N$ vectors in $\R^D$. What does it mean for the data vectors $\xv_1, . . . , \xv_N$ to be centered, as for principle component analysis (PCA) to be meaningful?
Use the notation $x_{nd}$ for individual entries. | def knn_weighting_estimate(doc_vectors, doc_labels, query_vector, k=10): """ Weighting estimation for kNN classification :param doc_vectors: Document vectors (np.array(np.array)) :param doc_labels: Document labels/topics (list) :param query_vector: Query vector (np.array) :param k: Number of nearest... | 0.1 | M1_preference_data_237 |
Your aim is to evaluate a movie review analysis system, the purpose of which is to classify the overall review's sentiment.For each movie review, such a system outputs one of the following classes: positive and negative.You perform your evaluation on a corpus that contains a total of 1000 reviews, out of which {neg} ar... | def reachable(n: Int, init: Set[Node], edges: List[Edge]): Set[Node] = n match { case 0 => init case _ => val next = init.flatMap(node => edges.filter(_.from == node).map(_.to)) reachable(n - 1, next, edges) } | 0.1 | M1_preference_data_238 |
In the context of Load Store Queue, How does the LSQ gets ordering information? | Clearly, $\phi(\mathbf{x})=f(\mathbf{x})$ will be the corresponding feature map. | 0.1 | M1_preference_data_239 |
Is the processors in recoder buffers ordered (e.g., FIFO-like) or an unordered structure?
Why? | Each old version should be in a branch of the repository, not in another repository | 0.1 | M1_preference_data_240 |
For the same processor, with the Memory to Execute forwarding
path, see if there exists a way to optimize this snippet of a
program (assume all instructions require a single cycle in the
Execute unit):
egin{verbatim}
add r5, r2, r1
mul r7, r12, r5
a... | Let us describe $\mathcal{H}$ by giving a procedure to sample an element $h\in \mathcal{H}$: \begin{itemize} \item for each $u\in U$, sample $h_u$ uniformly at random from $[0,1]$. \item set $h(A) = \min_{u\in A} h_u$ for any non-empty $A \subseteq U$ (i.e., MinHashing). \end{itemize} In Exercise Set 10, we showed tha... | 0.1 | M1_preference_data_241 |
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... | No! Assume that some algorithm does not ensure the causal delivery property but ensures its non-uniform variant. Assume also that m1 → m2.
This means that a correct process has to deliver m1 before delivering m2, but a faulty process is allowed to deliver m2 and not deliver m1.
However, a process doesn’t know that is f... | 0.1 | M1_preference_data_242 |
Consider the (toy) grammar $G$ consisting of the following rules:
R1: S --> NP VP
R2: NP --> NN
R3: NP --> Det NN
R4: NN --> N
R5: NN --> NN NN
R6: NN --> NN PNP
R7: PNP --> Prep NP
R8: VP --> V
R9: VP --> Adv V
What is the number $N$ of additional rules that should be added to $G$ to make it applicable to any sequence... | def minMax(data: ParSeq[Int]): (Int, Int) = data.map({ (x: Int) => (x, x) }).reduce({ case ((mn1, mx1), (mn2, mx2)) => (min(mn1, mn2), max(mx1, mx2)) }) Or: def minMax(data: ParSeq[Int]): (Int, Int) = (data.reduce(min), data.reduce(max)) | 0.1 | M1_preference_data_243 |
Imagine you're working at at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API. Your first task is to convert user feedback into user stories. Here is one such piece of feedback:
"Hi, I have been using your app for a long time, but ... | The solution is to differenciate the two kind of adjectives. For instance:
VP -> VBe Adj+
N -> Adj- N
Adj+ -> Adj+ PP
Adj+ -> Ving
Adj+ -> Adj
Adj- -> Adj
(and, of course, add the right PoS tag into the lexicon, e.g. former:Adj-).
Here we keep the PoS tag Adj for 'Adj- or Adj+'. | 0.1 | M1_preference_data_244 |
Consider the (toy) grammar $G$ consisting of the following rules:
R1: S --> NP VP
R2: NP --> NN
R3: NP --> Det NN
R4: NN --> N
R5: NN --> NN NN
R6: NN --> NN PNP
R7: PNP --> Prep NP
R8: VP --> V
R9: VP --> Adv V
In how many rules should the 9 rules provided for $G$ be expanded into to cope with simple number agreements... | By definition of $\gamma$ and $M$ we have that $\gamma/\|\wv_\star\|_2\leq M$. And therefore we obtain : t \leq rac{R^2}{M^2}
| 0.1 | M1_preference_data_245 |
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... | def generatePassedExams(students: List[Student], courses: List[Course]): List[(String, String, Int)] = students.flatMap {s => s.exams .filter(_.grade > 2) .flatMap {e => courses .filter(c => e.courseId == c.id) .map(c => (s.name, c.name, e.grade))}} | 0.1 | M1_preference_data_246 |
Freshly graduated from EPFL, you have been hired as contractors for a successful and rapidly growing bank. The bank has been experiencing problems with their money management system recently, which is written in Scala, and so they hired the best and brightest young engineer they could find: you! The system had been wor... | Let $y$ be an optimal solution to the linear program of value $\optlp$. We shall give a randomized rounding that outputs an $s,t$-cut that in expectation cuts $\optlp$ edges. Since any cut must cut at least $\opt$ edges, it then follows that $\optlp \geq \opt$. We now describe the rounding procedure. For each vertex $v... | 0.1 | M1_preference_data_247 |
Can we devise a broadcast algorithm that does not ensure the causal delivery property but only (in) its non-uniform variant:
No correct process pi delivers a message m2 unless pi has already delivered every message m1 such that m1 → m2? | $\Theta(n)$ | 0.1 | M1_preference_data_248 |
Assume you are working on a mobile application. Your team's graphic designer tells you:
"I wanted the logo to be exactly 250 pixels wide, but on my new phone it's not. This is a bug that needs fixing!"
In one sentence, explain whether you agree with the designer's assessment and why. | The schedule of statically scheduled HLS is known at
compile time, while with dynamically scheduled HLS,
dependences are encoded in the dataflow graph and resolved at
runtime. | 0.1 | M1_preference_data_249 |
In context of Meltdown Attack, what are the basic ideas of the attack and how they relate to
the snippet above? What is the microarchitectural mechanism targeted
by the attack? Is it likely to work on all processors with such
architectural mechanism or some pr... | ['(1000 - {fn} - {neg}) / ((1000 - {fn} - {neg}) + {fn})'] | 0.1 | M1_preference_data_250 |
In this problem, we give a $2$-approximation algorithm for the submodular vertex cover problem which is a generalization of the classic vertex cover problem seen in class. We first, in subproblem~\textbf{(a)}, give a new rounding for the classic vertex cover problem and then give the algorithm for the more general pr... | We partition the universe into $\sqrt{n}$ disjoint blocks $[n]=B_1\cup \ldots \cup B_{\sqrt{n}}$ each of size $\sqrt{n}$ and apply the AMS sketch with $\epsilon$ a sufficiently small constant and $\delta=1/n^2$. Denote the corresponding frequency vectors by $f^1,\ldots, f^{\sqrt{n}}\in \mathbb{R}^{\sqrt{n}}$. The algor... | 0.1 | M1_preference_data_251 |
What is the main difficulty in performing a Prime+Probe attack
on a system with L1 caches private to each core and a shared LLC,
and with attacker and victim running on different cores? How can
this difficulty be circumvented?
| Transformers
Transformers don’t have a recurrent computation, so the representations at each time step can directly attend to the representations at other time steps. As a result, it is more effective for modeling long-term dependencies because there is no vanishing gradients effect across time.
Because there is no rec... | 0.1 | M1_preference_data_252 |
Imagine that the data structure you are given, instead of an Array[A], is one called ParSeq[A]. This class offers the two following methods, which work in parallel: def map[B](f: A => B): ParSeq[B] def reduce(f: (A, A) => A): A Can you write the following minMax function in terms of map and/or reduce operations ? def... | /** * computes the 'hull' of a set of rectangles given as an array, i.e., the smallest * rectangle covering all rectangles. */ def hull(rs: Array[Rectangle]): Rectangle = rs.reduce(hull2) | 0.1 | M1_preference_data_253 |
Consider the following toy corpus: the cat cut the hat
How many different bigrams of characters (including whitespace) do you have in that corpus? | FIFO-like ordered structure. | 0.1 | M1_preference_data_254 |
What kind of exceptions require the processor to implement them precisely? Why? Give three examples of such exceptions. | ['(((80+1000-{a}-{b}+80)/1000)-((({a}*{b})/(1000*1000))+((1000-{a})*(1000-{b}))/(1000*1000)))/(1-((({a}*{b})/(1000*1000))+((1000-{a})*(1000-{b}))/(1000*1000)))'] | 0.1 | M1_preference_data_255 |
Consider the following document:
D = 'the exports from Switzerland to the USA are increasing in 2006'
Propose a possible indexing set for this document. Justify your answer. | At the current step, we have the following Simplex tableau: \begin{align*} \hspace{1cm} x_1 &= 1 + x_2 - s_1 & \text{ (1)}\\ s_2 &= 3 -x_2 + s_1 & \text{ (2)}\\ s_3 &= 2 -x_2& \text{ (3)}\\ \cline{1-2} z &= 2 + x_2 - 2s_1\\ x_1& :=1\text{ }x_2:=0\text{ }s_1:=0\text{ }s_2:=3\text{ }s_3:=2 \end{align*} Only $x_2$... | 0.1 | M1_preference_data_256 |
Assume you are working on a school project with your friend. Your friend uses "print" to debug his code. Is this a good idea and, regardless of whether it is bad or not, is there a better way to do it? Explain why or why not in max 2 sentences. | No! Assume that some broadcast algorithm ensures the causal delivery property and is not reliable, but best-effort; define an instance co of the corresponding abstraction, where processes co-broadcast and co-deliver messages.
The only way for an algorithm to be best-effort broadcast but not reliable broadcast is to vio... | 0.1 | M1_preference_data_257 |
What hardware support is necessary in a processor to implement
modulo scheduling? Name all hardware features involved and give a
brief explanation of each of them. | Variant 1: In this variant, property 2 can be violated. It is not susceptible to deadlocks. Variant 2: In this variant, neither of the two properties can be violated. However, it is susceptible to deadlocks. Variant 3: In this variant, neither of the two properties can be violated and no deadlock can occur. It is how... | 0.1 | M1_preference_data_258 |
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$:
For any function $g:\... | Changing the signature of a public method will break binary compatibility, as existing compiled code refers to the method using a "void"-returning signature. While the change is backward source compatible, it is not overall backward compatible. | 0.1 | M1_preference_data_259 |
Consider we use the set of transformations: insertion, deletion, substitution, and transposition. We want to compute the edit distance between words execution and exceuton, i.e. D(execution, exceuton).When computing the above, what is the value you get for D(exec,exce)?Give your answer as a numerical value. | /** * computes the 'hull' of two rectangles as a rectangle, i.e., the smallest * rectangle covering both rectangles. */ def hull2(r1: Rectangle, r2: Rectangle): Rectangle = // take the smallest coordinates of both lower left corners val newLowerLeft = Point( math.min(r1.lowerLeft.x, r2.lowerLeft.x), ... | 0.1 | M1_preference_data_260 |
You have $1$ Euro and your goal is to exchange it to Swiss francs during the next two consecutive days. The exchange rate is an arbitrary function from days to real numbers from the interval $[1,W^2]$, where $W\geq 1$ is known to the algorithm. More precisely, at day $1$, you learn the exchange rate $x_1 \in [1,W^2]$,... | 27^2 = 729 bigrams in total | 0.1 | M1_preference_data_261 |
Assume your colleague wants to wait until the next minor release to include a major bugfix instead of making a bugfix release. Explain why this is not a good idea. | Yes, because it will make "ShoppingCart" much easier to test by injecting a fake payment processor during unit tests. | 0.1 | M1_preference_data_262 |
Assume you have been working with a friend on a LinkedIn-like app, where a user can lookup the shortest path to another user on the platform. You currently have two issues, the operation of finding a path sometimes takes a considerable amount of time, and it freezes the app in the process. Your friend suggests to run t... | def minMax(a: Array[Int]): (Int, Int) = { val threshold = 10 def minMaxPar(from: Int, until: Int): (Int, Int) = { if (until - from <= threshold) { var i = from var min = a(from) var max = a(from) while (i < until) { val x = a(i) if(x < min) min = x if(x > max) max... | 0.1 | M1_preference_data_263 |
Implement a function that computes the confidence for a given set of rules and their respective support. You can use the following formula: $$\mathrm{conf}(X \Rightarrow Y) = \mathrm{supp}(X \cup Y) / \mathrm{supp}(X)$$ | Functionally, it does not matter. One could pick one at random,
execute the longest latency instructions first, or (if there is a
way to determine it efficiently) excecute the instructions with
more pending dependences first. | 0.1 | M1_preference_data_264 |
& \multicolumn{3}{c}{ extbf{ProofWriter}} & \multicolumn{3}{c}{ extbf{CLUTRR-SG}} \
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
What does the following function implement?
1 a => b => (not a) (not b) fls | Notice that there is absolutely no need to compute every pair of similarities!!!
Only 3 of them are useful, cf drawing (a); and even the drawing alone might be sufficient
(no computation at all)!
+------------------+
| |
| +-------+
| | |
| +------+ |
+---... | 0.1 | M1_preference_data_265 |
What does it mean that a processor implements precise exceptions? | When preparing benchmarks, your colleague should make sure that the inputs are representative of the real world, and complex enough to potentially detect performance bottlenecks. In this example, the inputs strings should be long enough. | 0.1 | M1_preference_data_266 |
Assume that the texts to be tagged contain 1.5% of unknown words and that the performance
of the tagger to be used is 98% on known words.
What will be its typical overall performance in the following situation:
all unknown words are systematically wrongly tagged? | Let $i^*$ be the weight of a minimum-weight perfect matching (and so $\mathcal{M}_{i^*}$ contains all perfect matchings of minimum weight). We first prove that \begin{align} \label{eq:prob} \Pr[f_{i^*}(p)= 0] \leq 1/n\,, \end{align} where the probability is over the random selection of $p(e)$'s in Step 2 of the algorit... | 0.1 | M1_preference_data_267 |
In Itanium's procedure call and return mechanism, Still ignoring potential problems during the execution of
erb+alloc+, what hardware changes are needed to the processor
(compared to a more traditional and straightforward VLIW processor)
to implement this functionality? | false | 0.1 | M1_preference_data_268 |
Consider the following grammar:
S -> NP VP
NP -> Det N
VP -> VBe Adj
NP -> NP PP
VP -> V
N -> Adj N
VP -> VP PP
Adj -> Adj PP
V -> VBe
Adj -> Ving
PP -> Prep NP
and the following lexicon:
at:Prep is:VBe old:Adj
black:Adj looking:Ving the:Det
cat:N mouse:N under:Prep
former:Adj nice:Adj with:Prep
This grammar also ... | Changing the signature of a private method does not break compatibility, since nobody else could call it. | 0.1 | M1_preference_data_269 |
Consider the (toy) grammar $G$ consisting of the following rules:
R1: S --> NP VP
R2: NP --> NN
R3: NP --> Det NN
R4: NN --> N
R5: NN --> NN NN
R6: NN --> NN PNP
R7: PNP --> Prep NP
R8: VP --> V
R9: VP --> Adv V
Precisely define the type of grammar G is corresponding to (for that, consider at least the following aspect... | ['2'] | 0.1 | M1_preference_data_270 |
Your colleague wants to improve the performance of a web application by caching common results in an in-memory LRU cache, where the least recently used results are evicted when the cache is full, and wants your opinion on the best way to implement it. He has already implemented the "Cache" interface, which he will use ... | The item is a user story, and is therefore suitable to be submitted. | 0.1 | M1_preference_data_271 |
Assume you are working on a trendy app that allows everyone to create and share quizzes! Your first task is to add a new feature. Here is a transcript from part of a conversation with a user:
> Hey! So you're the developer of this quiz app?
> The one where I can write questions and answers for my friends?
> I think it... | ... a list of strings, each string corresponding to the 8-bit representation of an element if and only
if that element is between 0 and 255 included. The most significant bit is farthest to the left in the
characters sequence.
Hint: The most significant bit represents the largest value in a multiple-bit binary number. | 0.1 | M1_preference_data_272 |
You are working on an app which is a search engine for cat photos. The app works by making requests to a server which stores the photos. Users search for cat photos and see a batch of results at a time; they can tap on a photo to see it full screen. You are getting two main complaints from users about the app’s perform... | 1. On the victim side, the prefetcher might also evict data
not corresponding to actual victim accesses, adding noise to
the attacker measurement. If the victim does not make accesses
in a regular manner, the prefetcher might not kick in, though.
... | 0.1 | M1_preference_data_273 |
Consider the $k$-means algorithm. We discussed in the course that this algorithm is efficient. But we also discussed that it might not converge to the optimal solution. Let us explore this in a very simple setting. Assume that your data is one-dimensional. I.e., the points of your training set $S_{\text {training }}$ a... | At the current step, we have the following Simplex tableau: \begin{align*} \hspace{1cm} x_1 &= 1 + 3x_2 - x_3 - s_1 & \text{ (1)}\\ s_2 &= 7 - 3x_2 + x_3 + s_1 & \text{ (2)}\\ s_3 &= 6 - 3x_2 - 2x_3 & \text{ (3)}\\ \cline{1-2} z &= 4 + 6x_2 - 4s_1\\ x_1& :=1\text{ }x_2:=0\text{ }x_3:=0\text{ }s_1:=0\text{ }s_2... | 0.1 | M1_preference_data_274 |
The objective of this question is to illustrate the use of a lexical semantics resource to compute
lexical cohesion.
Consider the following toy ontology providing a semantic structuring for a (small) set of nouns:
<ontology>
<node text='all'>
<children>
<node text='animate entities'>
... | Yes, the above solution does not have any deadlocks as the forks are acquired in a specific order. | 0.1 | M1_preference_data_275 |
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. Implement aggregate using the... | Including a major bugfix in a minor release instead of a bugfix release will cause an incoherent changelog and an inconvenience for users who wish to only apply the patch without any other changes. The bugfix could be as well an urgent security fix and should not wait to the next minor release date. | 0.1 | M1_preference_data_276 |
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 thinks that "canUpload" should be made public. Explain in 1 sentence whethe... | ccccb | 0.1 | M1_preference_data_277 |
Calculate the mean of individuals who remain alive in the data. The data is stored in a pandas.DataFrame and the respective column is "alive". | The positional constraints (word order) are taken into account by G; for example, "the frames break" is accepted by G, as it should, and "frames the break" is not, as it should;
The selectional constraints (agreements) are not taken into account by G; for example, "the frames break" is accepted by G, as it should, but ... | 0.1 | M1_preference_data_278 |
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 connectivity_ranking(G, nodes_community, communities, communities_count): ''' input: G:nx.Graph nodes_community:{node_id:community_id} communities:[community_ids] community_count:int output: communities_ranking:{community_id:ranking} ''' communities_... | 0.1 | M1_preference_data_279 |
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$. Is it possible to enforce a ranking $d_2 > d_1$ with vector space retrieval and $d_1 > d_2$ with probabilistic retrieval ($\lambda=0.5$), by adding the same doc... | [['break+V => breakable\xa0', 'derivational'], ['freeze+V =>\xa0frozen\xa0', 'inflectional'], ['translate+V => translation', 'derivational'], ['cat+N => cats', 'inflectional'], ['modify+V => modifies ', 'inflectional']] | 0.1 | M1_preference_data_280 |
You have $1$ Euro and your goal is to exchange it to Swiss francs during the next two consecutive days. The exchange rate is an arbitrary function from days to real numbers from the interval $[1,W^2]$, where $W\geq 1$ is known to the algorithm. More precisely, at day $1$, you learn the exchange rate $x_1 \in [1,W^2]$,... | We use the idea of the AMS algorithm. We first describe how Alice Alice calculates the message $m$. Let $\Alg$ be the following procedure: \begin{itemize} \item Select a random $h: [n] \rightarrow \{\pm 1\}$ $4$-wise independent hash function. $h$ takes $O(\log n)$ bits to store. \item Calculate $A = \sum_{i=1}^n h(i) ... | 0.1 | M1_preference_data_281 |
What is the communication complexity of the FloodSet algorithm in number of messages? | df.alive.mean() | 0.1 | M1_preference_data_282 |
You are asked to implement the following List functions using only the specified List API methods. You are also allowed to use the reverse method in any subquestion, should you see it fit. If you need another method of List, you need to reimplement it as part of your answer. Please refer to the appendix on the last pag... | Only Associativity | 0.1 | M1_preference_data_283 |
The MIPS R10000 fetches four instructions at once and, therefore,
there are four such circuits working in parallel inside the processor. What do ``WrPtr'' and ``RdPtr'' represent, respectively? Very
briefly explain what they are used for and when their value changes. | We use the same rounding scheme as in the first subproblem. We then have that the expected cost of our solution is \begin{align*} 2\int_0^{1/2} f(\{i: x_i \geq t\}) dt\,. \end{align*} On the other hand, \begin{align*} \hat f(x) = \int_0^1 f(\{i: x_i \geq t\}) dt = \int_0^{1/2} f(\{i: x_i \geq t\}) dt + \int_{1/2}^1 f(\... | 0.1 | M1_preference_data_284 |
You are given three classes (Student, Exam and Course which are defined below) and the method generatePassedExams, which from a given list of students and a list of courses, generates a list of students and all their successfully passed courses together with the corresponding grade. A course is considered as successful... | Let us assume that F processes in the system can be Byzantine.
Moreover, let us assume that N = 3F, where N is the total number of processes.
We separate all processes into three disjoint groups A, B and C such that |A| = |B| = |C| = F and S ∈ B.
Execution 1: All processes from group C are faulty and they are silent fo... | 0.1 | M1_preference_data_285 |
Briefly describe the specific objectives of the morphological module in the general perspective of automated Natural Language Processing. | Consider some $\ell = 1, \dots, k$ and define $\mathcal{I}_\ell = \{I \in \mathcal{I}: |I| \leq \ell\}$. There are two key observations: \begin{itemize} \item $\mathcal{M}_\ell = (E, \mathcal{I}_\ell)$ is a matroid called the truncated matroid of $M$. \item \textsc{Greedy} has an identical execution on $\mathcal{M}_\el... | 0.1 | M1_preference_data_286 |
An expression is referentially transparent if it always returns the same value, no matter
the global state of the program. A referentially transparent expression can be replaced by its value without
changing the result of the program.
Say we have a value representing a class of students and their GPAs. Given the follow... | 1. The inner loop can achieve low initiation interval with
static scheduling because the result of the condition is
statically determinable. In particular, unrolling the inner
loop by a factor five would completely remove the condition
and, approximately, have five iterations executing ... | 0.1 | M1_preference_data_287 |
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... | Yes, 800 columns would not be enough training data to learn a suitable generator. | 0.1 | M1_preference_data_288 |
& \multicolumn{3}{c}{ extbf{ProofWriter}} & \multicolumn{3}{c}{ extbf{CLUTRR-SG}} \
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
Consider the following code snippet:
1 type Logger[T] = T => Unit
2 def log[T](s: T)(using log: Logger[T]): Unit = log(s)
3 var count = 0
4 given countingLogger: Logger[String] = s... | MapTrNil, MapTrNil | 0.1 | M1_preference_data_289 |
Consider the following toy corpus: the cat cut the hat
How many occurences do you have in total? (i.e. including repertitions) | A dynamically scheduled circuit supporting speculation
would be able to achieve a perfect pipeline (assuming that the
if branch is never taken; the II would increase only if/when
the if condition evaluates to true). | 0.1 | M1_preference_data_290 |
Implement a Rocchio classifier | Yes | 0.1 | M1_preference_data_291 |
Implement a function that takes a list ls as argument, and returns a list of all the suffixes of ls. That is, given a list List(a,b,c,...) it returns List(List(a,b,c,...), List(b,c,...), List(c,...), List(...), ..., List()). Implement the function recursively using only Nil (empty), :: (cons) and pattern matching. def ... | The purpose of morphology is to study of the internal structure and the variability of the words in a language, like verbal conjugations, plurals, nominalization, ... | 0.1 | M1_preference_data_292 |
Split the given data into a training set (70%) and a testing set (30%). We refer to these as "random split" in the subsequent tasks. The data is in a pandas.DataFrame format. | extensionsToCheck = ["Facebook", "Google", "Microsoft", "Deepmind"]
df["has_top_company"] = df["institution"].apply(lambda x: any(ext in x for ext in extensionsToCheck)).astype("int")
df["csranking_list"] = df["csranking"].apply(lambda a: list(map(int, str(a).replace("-1","999").split(";"))))
df["has_top_institution"]... | 0.1 | M1_preference_data_293 |
Suppose we use the Simplex method to solve the following linear program: \begin{align*} \textbf{maximize} \hspace{0.8cm} & 4x_1 - x_2 - 2x_3 \\ \textbf{subject to}\hspace{0.8cm} & x_1 - x_3 + s_1 = 1 \\ \hspace{0.8cm} & \hspace{0.85cm}x_1 + s_2 = 4 \\ \hspace{0.8cm} & \hspace{-0.85cm} -3x_2 + 2x_3 + s_3 = 4 \\ \hs... | Use average precision : for each relevant document compute the average precision for all
relevant docs below rank R_k | 0.1 | M1_preference_data_294 |
What measure should you compute to estimate the quality of the annotations produced by the two annotators? | As a student, I want to see a list of all courses, so that I can choose which ones to take. | 0.1 | M1_preference_data_295 |
Assume you are working on a text editor written in Java. Your colleague is interested in optimizing a wrapper around "String.substring()" used to let users copy and paste parts of the text and decides to write some benchmarks to measure the current performance of the feature. How would you suggest that he proceeds? | We name “central” the city that we can reach from every other city either directly or through exactly one intermediate city.
Base case (n=2): It obviously holds. Either one of the cities is “central”.
Inductive step: Suppose this property holds for n ≥ 2 cities. We will prove that it will still hold for n+1 cities.
Le... | 0.1 | M1_preference_data_296 |
how can the results from a classifier impact the metric (precision) used? What could be a better suited metric to use with imbalanced data? | def cross_val(X,y,params,N=20, n_jobs=4):
# generate list of params
params_list = [{name:y for name,y in zip(params.keys(),x)} for x in list(itertools.product(*params.values()))]
# create kfold splitter
kfold = KFold(N)
# apply cross_val score function for each param set we have
... | 0.1 | M1_preference_data_297 |
If process i fails, then eventually all processes j≠i fail
Is the following true? If a process j≠i fails, then process i has failed | 1.In this case, the condition depends on runtime
information. The exttt{if} would be if-converted but the
worst-case branch execution latence (the one with the
multiplication) would determine the initiation interval due to
the loop carried dependency though exttt{acc}. Overall, the
... | 0.1 | M1_preference_data_298 |
We learnt in the lecture that terms are typically stored in an inverted list. Now, in the inverted list, instead of only storing document identifiers of the documents in which the term appears, assume we also store an *offset* of the appearance of a term in a document. An $offset$ of a term $l_k$ given a document is de... | If the deterministic sorting is done prior to proposing the set for consensus, instead of a posteriori upon deciding, the processes would not agree on a set but on a sequence of messages. But if they TO-deliver the messages in the decided order, the algorithm still ensures the total order property. | 0.1 | M1_preference_data_299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.