question
stringlengths
6
3.53k
text
stringlengths
17
2.05k
source
stringclasses
1 value
Consider a $d$-regular undirected graph $G = (V,E)$ and let $M$ be its normalized adjacency matrix. As seen in class, $M$ has $n= |V|$ eigenvalues $1=\lambda_1 \geq \lambda_2 \geq \ldots \geq \lambda_n\geq -1$ and the corresponding eigenvectors ${v}_1, {v}_2, \ldots, {v}_n \in \mathbb{R}^n$ can be selected to be orthog...
In such a scenario, the second smallest eigenvalue ( λ 2 {\displaystyle \lambda _{2}} ) of L {\displaystyle L} , yields a lower bound on the optimal cost ( c {\displaystyle c} ) of ratio-cut partition with c ≥ λ 2 n {\displaystyle c\geq {\frac {\lambda _{2}}{n}}} . The eigenvector ( V 2 {\displaystyle V_{2}} ) correspo...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider a $d$-regular undirected graph $G = (V,E)$ and let $M$ be its normalized adjacency matrix. As seen in class, $M$ has $n= |V|$ eigenvalues $1=\lambda_1 \geq \lambda_2 \geq \ldots \geq \lambda_n\geq -1$ and the corresponding eigenvectors ${v}_1, {v}_2, \ldots, {v}_n \in \mathbb{R}^n$ can be selected to be orthog...
Every two-graph is equivalent to a set of lines in some dimensional euclidean space each pair of which meet in the same angle. The set of lines constructed from a two graph on n vertices is obtained as follows. Let -ρ be the smallest eigenvalue of the Seidel adjacency matrix, A, of the two-graph, and suppose that it ha...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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. Given a set o...
In an undirected graph, an edge connecting two nodes has a single meaning. In a directed graph, the edges connecting two different nodes have different meanings, depending on their direction. Edges are the key concept in graph databases, representing an abstraction that is not directly implemented in a relational model...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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. Given a set o...
In computer science, a graph is an abstract data type that is meant to implement the undirected graph and directed graph concepts from the field of graph theory within mathematics. A graph data structure consists of a finite (and possibly mutable) set of vertices (also called nodes or points), together with a set of un...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the following definition of trees representing higher-order functions, as well as a recursive function subst0. 1 enum Expr: 2 case C(c: BigInt) 3 case N(name: String) 4 case BinOp(op: BinOps, e1: Expr, e2: Expr) 5 case IfNonzero(cond: Expr, trueE: Expr, falseE: Expr) 6 case Call(fun: Expr, arg: Expr) 7 case Fu...
Informally, and using programming language jargon, a tree (xy) can be thought of as a function x applied to an argument y. When evaluated (i.e., when the function is "applied" to the argument), the tree "returns a value", i.e., transforms into another tree. The "function", "argument" and the "value" are either combinat...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the following definition of trees representing higher-order functions, as well as a recursive function subst0. 1 enum Expr: 2 case C(c: BigInt) 3 case N(name: String) 4 case BinOp(op: BinOps, e1: Expr, e2: Expr) 5 case IfNonzero(cond: Expr, trueE: Expr, falseE: Expr) 6 case Call(fun: Expr, arg: Expr) 7 case Fu...
(1, if n = 0; else n × ((Y G) (n−1)))) (2−1)))) 4 × (3 × (2 × (1, if 1 = 0; else 1 × ((Y G) (1−1))))) 4 × (3 × (2 × (1 × (G (Y G) (1−1))))) 4 × (3 × (2 × (1 × ((λn. (1, if n = 0; else n × ((Y G) (n−1)))) (1−1))))) 4 × (3 × (2 × (1 × (1, if 0 = 0; else 0 × ((Y G) (0−1)))))) 4 × (3 × (2 × (1 × (1)))) 24Every recursively ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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) ===...
In particular, when an identity element is required by the type of structure, the identity element of the first structure must be mapped to the corresponding identity element of the second structure. For example: A semigroup homomorphism is a map between semigroups that preserves the semigroup operation. A monoid homom...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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) ===...
The class of all semigroups forms a variety of algebras of signature (2), meaning that a semigroup has a single binary operation. A sufficient defining equation is the associative law: x ( y z ) = ( x y ) z . {\displaystyle x(yz)=(xy)z.} The class of groups forms a variety of algebras of signature (2,0,1), the three op...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
In mathematics, a multiset (or bag, or mset) is a modification of the concept of a set that, unlike a set, allows for multiple instances for each of its elements. The number of instances given for each element is called the multiplicity of that element in the multiset. As a consequence, an infinite number of multisets ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
The multiset construction, denoted A = M { B } {\displaystyle {\mathcal {A}}={\mathfrak {M}}\{{\mathcal {B}}\}} is a generalization of the set construction. In the set construction, each element can occur zero or one times. In a multiset, each element can appear an arbitrary number of times.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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.)}
Hall's marriage theorem provides a condition guaranteeing that a bipartite graph (X + Y, E) admits a perfect matching, or - more generally - a matching that saturates all vertices of Y. The condition involves the number of neighbors of subsets of Y. Generalizing Hall's theorem to hypergraphs requires a generalization o...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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.)}
When Hall's condition does not hold, the original theorem tells us only that a perfect matching does not exist, but does not tell what is the largest matching that does exist. To learn this information, we need the notion of deficiency of a graph. Given a bipartite graph G = (X+Y, E), the deficiency of G w.r.t. X is th...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following function sums: 1 def add(c: Int, acc: List[(Int, Int)]): List[(Int, Int)] = acc match 2 case Nil => List((c, 1)) 3 case x :: xs => if x._1 == c then (c, x._2+1) :: xs else x :: add(c, xs) 4 5 def sums(digits: List[Int]): List[(Int, Int)] = 6 digits.foldRight(List[(Int, Int)]())(add) Your task is to ...
At this point there are two single-digit numbers, the first derived from the first operand and the second derived from the second operand. Apply the originally specified operation to the two condensed operands, and then apply the summing-of-digits procedure to the result of the operation. Sum the digits of the result t...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following function sums: 1 def add(c: Int, acc: List[(Int, Int)]): List[(Int, Int)] = acc match 2 case Nil => List((c, 1)) 3 case x :: xs => if x._1 == c then (c, x._2+1) :: xs else x :: add(c, xs) 4 5 def sums(digits: List[Int]): List[(Int, Int)] = 6 digits.foldRight(List[(Int, Int)]())(add) Your task is to ...
After applying an arithmetic operation to two operands and getting a result, the following procedure can be used to improve confidence in the correctness of the result: Sum the digits of the first operand; any 9s (or sets of digits that add to 9) can be counted as 0. If the resulting sum has two or more digits, sum tho...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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$...
Because the problem of testing whether a graph is class 1 is NP-complete, there is no known polynomial time algorithm for edge-coloring every graph with an optimal number of colors. Nevertheless, a number of algorithms have been developed that relax one or more of these criteria: they only work on a subset of graphs, o...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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$...
For some graphs, such as bipartite graphs and high-degree planar graphs, the number of colors is always Δ, and for multigraphs, the number of colors may be as large as 3Δ/2. There are polynomial time algorithms that construct optimal colorings of bipartite graphs, and colorings of non-bipartite simple graphs that use a...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the following algorithm that takes as input a complete $n$-by-$n$ bipartite graph $G=(U \cup V,E)$ with positive integer edge-weights $w :E \rightarrow \mathbb{Z}_{> 0 }$: \begin{center} \begin{boxedminipage}[t]{0.85\textwidth} \begin{minipage}{14cm} \begin{verse} \textsc{MinWeightPerfectMatching}$(G, w)$: \\...
The original application was to minimum-weight (or maximum-weight) perfect matchings in a graph. Each edge is assigned a random weight in {1, …, 2m}, and F {\displaystyle {\mathcal {F}}} is the set of perfect matchings, so that with probability at least 1/2, there exists a unique perfect matching. When each indetermina...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the following algorithm that takes as input a complete $n$-by-$n$ bipartite graph $G=(U \cup V,E)$ with positive integer edge-weights $w :E \rightarrow \mathbb{Z}_{> 0 }$: \begin{center} \begin{boxedminipage}[t]{0.85\textwidth} \begin{minipage}{14cm} \begin{verse} \textsc{MinWeightPerfectMatching}$(G, w)$: \\...
These weights should exceed the weights of all existing matchings, to prevent appearance of artificial edges in the possible solution. As shown by Mulmuley, Vazirani and Vazirani, the problem of minimum weight perfect matching is converted to finding minors in the adjacency matrix of a graph. Using the isolation lemma,...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Recall the Jaccard index that we saw in Exercise Set 10: Suppose we have a universe $U$. For non-empty sets $A,B \subseteq U$, the Jaccard index is defined as \begin{align*} J(A,B) = \frac{|A \cap B|}{|A \cup B|}\,. \end{align*} Design a locality sensitive hash (LSH) family $\mathcal{H}$ of functions $h: 2^U \rightarr...
Suppose U is composed of subsets of some ground set of enumerable items S and the similarity function of interest is the Jaccard index J. If π is a permutation on the indices of S, for A ⊆ S {\displaystyle A\subseteq S} let h ( A ) = min a ∈ A { π ( a ) } {\displaystyle h(A)=\min _{a\in A}\{\pi (a)\}} . Each possible c...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Recall the Jaccard index that we saw in Exercise Set 10: Suppose we have a universe $U$. For non-empty sets $A,B \subseteq U$, the Jaccard index is defined as \begin{align*} J(A,B) = \frac{|A \cap B|}{|A \cup B|}\,. \end{align*} Design a locality sensitive hash (LSH) family $\mathcal{H}$ of functions $h: 2^U \rightarr...
If μ {\displaystyle \mu } is a measure on a measurable space X {\displaystyle X} , then we define the Jaccard coefficient by J μ ( A , B ) = μ ( A ∩ B ) μ ( A ∪ B ) , {\displaystyle J_{\mu }(A,B)={{\mu (A\cap B)} \over {\mu (A\cup B)}},} and the Jaccard distance by d μ ( A , B ) = 1 − J μ ( A , B ) = μ ( A △ B ) μ ( A ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Do the functions first and second return the same output for every possible input? def first(x: List[Int]): Int = x.head + first(x.tail) def second(x: List[Int]): Int = x.foldLeft(0)(_ + _)
Function 2 is function 1 with the lines swapped. In the case of a function calling itself only once, instructions placed before the recursive call are executed once per recursion before any of the instructions placed after the recursive call. The latter are executed repeatedly after the maximum recursion has been reach...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Do the functions first and second return the same output for every possible input? def first(x: List[Int]): Int = x.head + first(x.tail) def second(x: List[Int]): Int = x.foldLeft(0)(_ + _)
Using Haskell as an example, foldl and foldr can be formulated in a few equations. If the list is empty, the result is the initial value. If not, fold the tail of the list using as new initial value the result of applying f to the old initial value and the first element. If the list is empty, the result is the initial ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following data structure: enum IntSet: \t case Empty \t case NonEmpty(x: Int, l: IntSet, r: IntSet) And the following lemmas, holding for all x: Int, xs: List[Int], ys: List[Int], l: IntSet and r: IntSet: (SizeNil) nil.size === 0 (SizeCons) (x :: xs).size === xs.size + 1 (ConcatSize) (xs ++ ys).size === xs.si...
The empty set has 0 members and 1 subset, and 20 = 1. The induction hypothesis is the proposition in case n; we use it to prove case n + 1. In a size-(n + 1) set, choose a distinguished element.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following data structure: enum IntSet: \t case Empty \t case NonEmpty(x: Int, l: IntSet, r: IntSet) And the following lemmas, holding for all x: Int, xs: List[Int], ys: List[Int], l: IntSet and r: IntSet: (SizeNil) nil.size === 0 (SizeCons) (x :: xs).size === xs.size + 1 (ConcatSize) (xs ++ ys).size === xs.si...
The proof of part 1 of the first recursion theorem is obtained by iterating the enumeration operator Φ beginning with the empty set. First, a sequence Fk is constructed, for k = 0 , 1 , … {\displaystyle k=0,1,\ldots } . Let F0 be the empty set.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Two linear maps S and T in L(V, W) induce the same map between P(V) and P(W) if and only if they differ by a scalar multiple, that is if T = λS for some λ ≠ 0. Thus if one identifies the scalar multiples of the identity map with the underlying field K, the set of K-linear morphisms from P(V) to P(W) is simply P(L(V, W)...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
The maps between the kernels and the maps between the cokernels are induced in a natural manner by the given (horizontal) maps because of the diagram's commutativity. The exactness of the two induced sequences follows in a straightforward way from the exactness of the rows of the original diagram. The important stateme...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following function sums: 1 def add(c: Int, acc: List[(Int, Int)]): List[(Int, Int)] = acc match 2 case Nil => List((c, 1)) 3 case x :: xs => if x._1 == c then (c, x._2+1) :: xs else x :: add(c, xs) 4 5 def sums(digits: List[Int]): List[(Int, Int)] = 6 digits.foldRight(List[(Int, Int)]())(add) Your task is to ...
At this point there are two single-digit numbers, the first derived from the first operand and the second derived from the second operand. Apply the originally specified operation to the two condensed operands, and then apply the summing-of-digits procedure to the result of the operation. Sum the digits of the result t...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following function sums: 1 def add(c: Int, acc: List[(Int, Int)]): List[(Int, Int)] = acc match 2 case Nil => List((c, 1)) 3 case x :: xs => if x._1 == c then (c, x._2+1) :: xs else x :: add(c, xs) 4 5 def sums(digits: List[Int]): List[(Int, Int)] = 6 digits.foldRight(List[(Int, Int)]())(add) Your task is to ...
After applying an arithmetic operation to two operands and getting a result, the following procedure can be used to improve confidence in the correctness of the result: Sum the digits of the first operand; any 9s (or sets of digits that add to 9) can be counted as 0. If the resulting sum has two or more digits, sum tho...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider an undirected graph $G=(V,E)$ and let $s\neq t\in V$. In the minimum (unweighted) $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. We shall use a linear program to solve this problem. Let ${P}$ be the set of all pat...
For weighted graphs with positive edge weights w: E → R + {\displaystyle w\colon E\rightarrow \mathbf {R} ^{+}} the weight of the cut is the sum of the weights of edges between vertices in each part w ( S , T ) = ∑ u v ∈ E: u ∈ S , v ∈ T w ( u v ) , {\displaystyle w(S,T)=\sum _{uv\in E\colon u\in S,v\in T}w(uv)\,,} whi...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider an undirected graph $G=(V,E)$ and let $s\neq t\in V$. In the minimum (unweighted) $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. We shall use a linear program to solve this problem. Let ${P}$ be the set of all pat...
The cutting-plane method for solving 0–1 integer programs, first introduced for the traveling salesman problem by Dantzig, Fulkerson & Johnson (1954) and generalized to other integer programs by Gomory (1958), takes advantage of this multiplicity of possible relaxations by finding a sequence of relaxations that more ti...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Let $E$ be a finite ground set and let $\mathcal{I}$ be a family of ground sets. Which of the following definitions of $\mathcal{I}$ guarantees that $M = (E, \mathcal{I})$ is a matroid? \begin{enumerate} \item $E$ is the edges of an undirected bipartite graph and $\mathcal{I} = \{X \subseteq E : \mbox{$X$ is an acyclic...
In terms of independence, a finite matroid M {\displaystyle M} is a pair ( E , I ) {\displaystyle (E,{\mathcal {I}})} , where E {\displaystyle E} is a finite set (called the ground set) and I {\displaystyle {\mathcal {I}}} is a family of subsets of E {\displaystyle E} (called the independent sets) with the following pr...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Let $E$ be a finite ground set and let $\mathcal{I}$ be a family of ground sets. Which of the following definitions of $\mathcal{I}$ guarantees that $M = (E, \mathcal{I})$ is a matroid? \begin{enumerate} \item $E$ is the edges of an undirected bipartite graph and $\mathcal{I} = \{X \subseteq E : \mbox{$X$ is an acyclic...
The collections of dependent sets, of bases, and of circuits each have simple properties that may be taken as axioms for a matroid. For instance, one may define a matroid M {\displaystyle M} to be a pair ( E , B ) {\displaystyle (E,{\mathcal {B}})} , where E {\displaystyle E} is a finite set as before and B {\displayst...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Clearly, replacing x=x * 10 with either 10 or 100 gives a program a different meaning, and so the expression is not referentially transparent. In fact, assignment statements are never referentially transparent. Now, consider another function such as int plusone(int x) {return x+1;} is transparent, as it does not implic...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Absence of side effects is a necessary, but not sufficient, condition for referential transparency. Referential transparency means that an expression (such as a function call) can be replaced with its value. This requires that the expression is pure, that is to say the expression must be deterministic (always give the ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Consider the following linear program in standard form: min x c T x subjected to A x = b x ∈ R + {\displaystyle {\begin{aligned}&\min _{x}c^{T}x\\&{\text{subjected to}}\\&Ax=b\\&x\in \mathbb {R} ^{+}\end{aligned}}} which we will call the primal problem as well as its dual linear program: max u u T b subjected to u T A ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Let an integer programming problem be formulated (in canonical form) as: Maximize c T x Subject to A x ≤ b , x ≥ 0 , x i all integers . {\displaystyle {\begin{aligned}{\text{Maximize }}&c^{T}x\\{\text{Subject to }}&Ax\leq b,\\&x\geq 0,\,x_{i}{\text{ all integers}}.\end{aligned}}} where A is a matrix and b , c is a vect...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Clearly, replacing x=x * 10 with either 10 or 100 gives a program a different meaning, and so the expression is not referentially transparent. In fact, assignment statements are never referentially transparent. Now, consider another function such as int plusone(int x) {return x+1;} is transparent, as it does not implic...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Absence of side effects is a necessary, but not sufficient, condition for referential transparency. Referential transparency means that an expression (such as a function call) can be replaced with its value. This requires that the expression is pure, that is to say the expression must be deterministic (always give the ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Design and analyze a polynomial time algorithm for the following problem: \begin{description} \item[INPUT:] An undirected graph $G=(V,E)$. \item[OUTPUT:] A non-negative vertex potential $p(v)\geq 0$ for each vertex $v\in V$ such that \begin{align*} \sum_{v\in S} p(v) \leq |E(S, \bar S)| \quad \mbox{for every $\emptyset...
This algorithm can be derandomized with the method of conditional probabilities; therefore there is a simple deterministic polynomial-time 0.5-approximation algorithm as well. One such algorithm starts with an arbitrary partition of the vertices of the given graph G = ( V , E ) {\displaystyle G=(V,E)} and repeatedly mo...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Design and analyze a polynomial time algorithm for the following problem: \begin{description} \item[INPUT:] An undirected graph $G=(V,E)$. \item[OUTPUT:] A non-negative vertex potential $p(v)\geq 0$ for each vertex $v\in V$ such that \begin{align*} \sum_{v\in S} p(v) \leq |E(S, \bar S)| \quad \mbox{for every $\emptyset...
Given an undirected graph G = (V, E) with an assignment of weights to the edges w: E → N and an integer k ∈ { 2 , 3 , … , | V | } , {\displaystyle k\in \{2,3,\ldots ,|V|\},} partition V into k disjoint sets F = { C 1 , C 2 , … , C k } {\displaystyle F=\{C_{1},C_{2},\ldots ,C_{k}\}} while minimizing ∑ i = 1 k − 1 ∑ j = ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the standard linear programming relaxation of Set Cover that we saw in class. We gave a randomized rounding algorithm for the Set Cover problem. Use similar techniques to give an algorithm that, with probability at least a positive constant, returns a collection of sets that cover at least $90\%$ of the eleme...
One can turn the linear programming relaxation for this problem into an approximate solution of the original unrelaxed set cover instance via the technique of randomized rounding (Raghavan & Tompson 1987). Given a fractional cover, in which each set Si has weight wi, choose randomly the value of each 0–1 indicator vari...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the standard linear programming relaxation of Set Cover that we saw in class. We gave a randomized rounding algorithm for the Set Cover problem. Use similar techniques to give an algorithm that, with probability at least a positive constant, returns a collection of sets that cover at least $90\%$ of the eleme...
The following example illustrates how randomized rounding can be used to design an approximation algorithm for the Set Cover problem. Fix any instance ⟨ c , S ⟩ {\displaystyle \langle c,{\mathcal {S}}\rangle } of set cover over a universe U {\displaystyle {\mathcal {U}}} . For step 1, let IP be the standard integer lin...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Clearly, replacing x=x * 10 with either 10 or 100 gives a program a different meaning, and so the expression is not referentially transparent. In fact, assignment statements are never referentially transparent. Now, consider another function such as int plusone(int x) {return x+1;} is transparent, as it does not implic...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
I call a mode of containment φ referentially transparent if, whenever an occurrence of a singular term t is purely referential in a term or sentence ψ(t), it is purely referential also in the containing term or sentence φ(ψ(t)). The term appeared in its contemporary computer science usage in the discussion of variables...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following method: 1 def mystery6(nIter: Int) (ss: List[String] ): List[String] = 2 if nIter <= 0 then ss 3 else mystery6 (nIter - 1) ( 4 for 5 s <- ss 6 c <- List (’c’ , ’b’ , ’a’) 7 yield 8 s + c 9 ) ::: ss What is the output if we call mystery6 this way: mystery6(5)(List("")).filter(_.exists(_ == ’b’))(0)
Python uses the following syntax to express list comprehensions over finite lists: A generator expression may be used in Python versions >= 2.4 which gives lazy evaluation over its input, and can be used with generators to iterate over 'infinite' input such as the count generator function which returns successive integ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Given the following method: 1 def mystery6(nIter: Int) (ss: List[String] ): List[String] = 2 if nIter <= 0 then ss 3 else mystery6 (nIter - 1) ( 4 for 5 s <- ss 6 c <- List (’c’ , ’b’ , ’a’) 7 yield 8 s + c 9 ) ::: ss What is the output if we call mystery6 this way: mystery6(5)(List("")).filter(_.exists(_ == ’b’))(0)
An alternative representation is Scott encoding, which uses the idea of continuations and can lead to simpler code. (see also Mogensen–Scott encoding). In this approach, we use the fact that lists can be observed using pattern matching expression. For example, using Scala notation, if list denotes a value of type List ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
One of the main applications of LSH is to provide a method for efficient approximate nearest neighbor search algorithms. Consider an LSH family F {\displaystyle {\mathcal {F}}} . The algorithm has two main parameters: the width parameter k and the number of hash tables L. In the first step, we define a new family G {\d...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
As a result, the statistical distance to a uniform family is O ( m / p ) {\displaystyle O(m/p)} , which becomes negligible when p ≫ m {\displaystyle p\gg m} . The family of simpler hash functions h a ( x ) = ( a x mod p ) mod m {\displaystyle h_{a}(x)=(ax~{\bmod {~}}p)~{\bmod {~}}m} is only approximately universal: Pr ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Church booleans are a representation of booleans in the lambda calculus. The Church encoding of true and false are functions of two parameters: Church encoding of tru: t => f => t Church encoding of fls: t => f => f What should replace ??? so that the following function computes not(b and c)? b => c => b ??? (not b)
Church Booleans are the Church encoding of the Boolean values true and false. Some programming languages use these as an implementation model for Boolean arithmetic; examples are Smalltalk and Pico. Boolean logic may be considered as a choice. The Church encoding of true and false are functions of two parameters: true ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Church booleans are a representation of booleans in the lambda calculus. The Church encoding of true and false are functions of two parameters: Church encoding of tru: t => f => t Church encoding of fls: t => f => f What should replace ??? so that the following function computes not(b and c)? b => c => b ??? (not b)
false chooses the second parameter.The two definitions are known as Church Booleans: true ≡ λ a . λ b . a false ≡ λ a .
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Let a linear program be given by a canonical tableau. The simplex algorithm proceeds by performing successive pivot operations each of which give an improved basic feasible solution; the choice of pivot element at each step is largely determined by the requirement that this pivot improves the solution.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Using the simplex method to solve a linear program produces a set of equations of the form x i + ∑ j a ¯ i , j x j = b ¯ i {\displaystyle x_{i}+\sum _{j}{\bar {a}}_{i,j}x_{j}={\bar {b}}_{i}} where xi is a basic variable and the xj's are the nonbasic variables (i.e. the basic solution which is an optimal solution to the...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Suppose that Alice and Bob have two documents $d_A$ and $d_B$ respectively, and Charlie wants to learn about the difference between them. We represent each document by its word frequency vector as follows. We assume that words in $d_A$ and $d_B$ come from some dictionary of size $n$, and let $x\in \mathbb{R}^n$ be a ve...
Given that there are three occurrences of letters followed by an L, the resulting probability is 1 3 ⋅ 3 12 = 1 12 {\displaystyle {1 \over 3}\cdot {3 \over 12}={1 \over 12}} . We obtain 17 words, which can each be encoded into a fixed-sized output of ⌈ log 2 ⁡ ( 17 ) ⌉ = 5 {\displaystyle \lceil \log _{2}(17)\rceil =5} ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Suppose that Alice and Bob have two documents $d_A$ and $d_B$ respectively, and Charlie wants to learn about the difference between them. We represent each document by its word frequency vector as follows. We assume that words in $d_A$ and $d_B$ come from some dictionary of size $n$, and let $x\in \mathbb{R}^n$ be a ve...
Now let the stream of bytes provide a string of overlapping 5-letter words, each "letter" taking values A, B, C, D, E. The letters are determined by the number of 1s in a byte 0, 1, or 2 yield A, 3 yields B, 4 yields C, 5 yields D and 6, 7 or 8 yield E. Thus we have a monkey at a typewriter hitting five keys with vario...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
There are 2 | V | {\displaystyle 2^{|V|}} ways of choosing for each vertex whether it belongs to S {\displaystyle S} or to T {\displaystyle T} , but two of these choices make S {\displaystyle S} or T {\displaystyle T} empty and do not give rise to cuts. Among the remaining choices, swapping the roles of S {\displaystyl...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
By repeating the contraction algorithm T = ( n 2 ) ln ⁡ n {\displaystyle T={\binom {n}{2}}\ln n} times with independent random choices and returning the smallest cut, the probability of not finding a minimum cut is T ≤ 1 e ln ⁡ n = 1 n . {\displaystyle \left^{T}\leq {\frac {1}{e^{\ln n}}}={\frac {1}{n}}\,.} The total ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
A beautiful result by the Swiss mathematician Leonhard Euler (1707 - 1783) can be stated as follows: \begin{itemize} \item[] Let $G= (V,E)$ be an undirected graph. If every vertex has an even degree, then we can orient the edges in $E$ to obtain a directed graph where the in-degree of each vertex equals its out-degree....
This is an orientation with the property that, for every pair of vertices u and v in G, the number of pairwise edge-disjoint directed paths from u to v in the resulting directed graph is at least ⌊ k 2 ⌋ {\displaystyle \left\lfloor {\frac {k}{2}}\right\rfloor } , where k is the maximum number of paths in a set of edge-...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
A beautiful result by the Swiss mathematician Leonhard Euler (1707 - 1783) can be stated as follows: \begin{itemize} \item[] Let $G= (V,E)$ be an undirected graph. If every vertex has an even degree, then we can orient the edges in $E$ to obtain a directed graph where the in-degree of each vertex equals its out-degree....
A strong orientation of a given bridgeless undirected graph may be found in linear time by performing a depth-first search of the graph, orienting all edges in the depth-first search tree away from the tree root, and orienting all the remaining edges (which must necessarily connect an ancestor and a descendant in the d...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the linear programming relaxation for minimum-weight vertex cover: \begin{align*} \text{Minimize} \quad &\sum_{v\in V} x_v w(v)\\ \text{Subject to} \quad &x_u + x_v \geq 1 \quad \forall \{u,v\} \in E \\ &0 \leq x_v \leq 1 \quad \ \ \forall v \in V \end{align*} In class, we saw that any extreme point is integ...
Assume that every vertex has an associated cost of c ( v ) ≥ 0 {\displaystyle c(v)\geq 0} . The (weighted) minimum vertex cover problem can be formulated as the following integer linear program (ILP). This ILP belongs to the more general class of ILPs for covering problems. The integrality gap of this ILP is 2 {\displa...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the linear programming relaxation for minimum-weight vertex cover: \begin{align*} \text{Minimize} \quad &\sum_{v\in V} x_v w(v)\\ \text{Subject to} \quad &x_u + x_v \geq 1 \quad \forall \{u,v\} \in E \\ &0 \leq x_v \leq 1 \quad \ \ \forall v \in V \end{align*} In class, we saw that any extreme point is integ...
The vertex cover problem involves finding a set of vertices that touches every edge of the graph. It is NP-hard but can be approximated to within an approximation ratio of two, for instance by taking the endpoints of the matched edges in any maximal matching. Evidence that this is the best possible approximation ratio ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
To which expression is the following for-loop translated ? 1 def mystery8(xs : List[List[Int]]) = 2 for 3 x <- xs 4 y <- x 5 yield 6 y
Instead of the Java "foreach" loops for looping through an iterator, Scala has for-expressions, which are similar to list comprehensions in languages such as Haskell, or a combination of list comprehensions and generator expressions in Python. For-expressions using the yield keyword allow a new collection to be generat...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
To which expression is the following for-loop translated ? 1 def mystery8(xs : List[List[Int]]) = 2 for 3 x <- xs 4 y <- x 5 yield 6 y
A similar notation available in a number of programming languages (notably Python and Haskell) is the list comprehension, which combines map and filter operations over one or more lists. In Python, the set-builder's braces are replaced with square brackets, parentheses, or curly braces, giving list, generator, and set ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
To which expression is the following for-loop translated? for x <- xs if x > 5; y <- ys yield x + y
Instead of the Java "foreach" loops for looping through an iterator, Scala has for-expressions, which are similar to list comprehensions in languages such as Haskell, or a combination of list comprehensions and generator expressions in Python. For-expressions using the yield keyword allow a new collection to be generat...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
To which expression is the following for-loop translated? for x <- xs if x > 5; y <- ys yield x + y
The syntax of the JavaScript for loop is as follows: or
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
This implementation is written in Python; it is assumed that the input_list will be a sequence of integers. The function returns a new list rather than mutating the one passed in, but it can be trivially modified to operate in place efficiently. We can also implement the algorithm using Java.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
This can be compiled into an executable which matches and outputs strings of integers. For example, given the input: abc123z. !&*2gj6 the program will print: Saw an integer: 123 Saw an integer: 2 Saw an integer: 6
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
They also highlight the fact that foldr (:) is the identity function on lists (a shallow copy in Lisp parlance), as replacing cons with cons and nil with nil will not change the result. The left fold diagram suggests an easy way to reverse a list, foldl (flip (:)) . Note that the parameters to cons must be flipped, be...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Were the function f to refer to its second argument first here, and be able to produce some part of its result without reference to the recursive case (here, on its left i.e., in its first argument), then the recursion would stop. This means that while foldr recurses on the right, it allows for a lazy combining functio...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Subtyping and inheritance are independent (orthogonal) relationships. They may coincide, but none is a special case of the other. In other words, between two types S and T, all combinations of subtyping and inheritance are possible: S is neither a subtype nor a derived type of T S is a subtype but is not a derived type...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Sound structural subtyping rules for types other than object types are also well known.Implementations of programming languages with subtyping fall into two general classes: inclusive implementations, in which the representation of any value of type A also represents the same value at type B if A <: B, and coercive imp...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
For a bipartite graph, devise an efficient algorithm for finding an augmenting path $P$ (if one exists). What is the total running time of the \textsc{AugmentingPathAlgorithm} explained in the second lecture?
The search for an augmenting path uses an auxiliary data structure consisting of a forest F whose individual trees correspond to specific portions of the graph G. In fact, the forest F is the same that would be used to find maximum matchings in bipartite graphs (without need for shrinking blossoms). In each iteration t...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
For a bipartite graph, devise an efficient algorithm for finding an augmenting path $P$ (if one exists). What is the total running time of the \textsc{AugmentingPathAlgorithm} explained in the second lecture?
An improvement to this algorithm is given by the more elaborate Hopcroft–Karp algorithm, which searches for multiple augmenting paths simultaneously. This algorithm runs in O ( V E ) {\displaystyle O({\sqrt {V}}E)} time. The algorithm of Chandran and Hochbaum for bipartite graphs runs in time that depends on the size o...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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$...
Suppose there are n {\displaystyle n} experts and the best expert makes m {\displaystyle m} mistakes. The weighted majority algorithm (WMA) makes at most 2.4 ( log 2 ⁡ n + m ) {\displaystyle 2.4(\log _{2}n+m)} mistakes, which is not a very good bound. We can do better by introducing randomization.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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$...
The nonrandomized weighted majority algorithm (WMA) only guarantees an upper bound of 2.4 ( log 2 ⁡ n + m ) {\displaystyle 2.4(\log _{2}n+m)} , which is problematic for highly error-prone experts (e.g. the best expert still makes a mistake 20% of the time.) Suppose we do N = 100 {\displaystyle N=100} rounds using n = 1...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider an IR system using a Vector Space model with Okapi BM25 as the weighting scheme (with \(k=1.5\) and \(b=0.75\)) and operating on a document collection that contains:a document \(d_1\), andand a document \(d_3\) corresponding to the concatenation of 3 copies of \(d_1\).Indicate which of the following statements...
The computed Tk and Dk matrices define the term and document vector spaces, which with the computed singular values, Sk, embody the conceptual information derived from the document collection. The similarity of terms or documents within these spaces is a factor of how close they are to each other in these spaces, typic...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider an IR system using a Vector Space model with Okapi BM25 as the weighting scheme (with \(k=1.5\) and \(b=0.75\)) and operating on a document collection that contains:a document \(d_1\), andand a document \(d_3\) corresponding to the concatenation of 3 copies of \(d_1\).Indicate which of the following statements...
Documents and queries are represented as vectors. d j = ( w 1 , j , w 2 , j , … , w n , j ) {\displaystyle d_{j}=(w_{1,j},w_{2,j},\dotsc ,w_{n,j})} q = ( w 1 , q , w 2 , q , … , w n , q ) {\displaystyle q=(w_{1,q},w_{2,q},\dotsc ,w_{n,q})} Each dimension corresponds to a separate term. If a term occurs in the document,...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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 ...
Naive Bayes classifiers are a popular statistical technique of e-mail filtering. They typically use bag-of-words features to identify email spam, an approach commonly used in text classification. Naive Bayes classifiers work by correlating the use of tokens (typically words, or sometimes other things), with spam and no...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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 ...
In statistics, naive Bayes classifiers are a family of simple "probabilistic classifiers" based on applying Bayes' theorem with strong (naive) independence assumptions between the features (see Bayes classifier). They are among the simplest Bayesian network models, but coupled with kernel density estimation, they can a...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
What measure should you compute to estimate the quality of the annotations produced by the two annotators?
The quality of the sequence assembly influences the quality of the annotation, so it is important to assess assembly quality before performing the subsequent annotation steps. In order to quantify the quality of a genome annotation, three metrics have been used: recall, precision and accuracy; although these measures a...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
What measure should you compute to estimate the quality of the annotations produced by the two annotators?
Confusion matrix for two annotators, three categories {Yes, No, Maybe} and 45 items rated (90 ratings for 2 annotators): To calculate the expected agreement, sum marginals across annotators and divide by the total number of ratings to obtain joint proportions. Square and total these: To calculate observed agreement, di...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Briefly describe the specific objectives of the morphological module in the general perspective of automated Natural Language Processing.
"Explorations in automated language classification". Folia Linguistica. 42 (2): 331–354.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Briefly describe the specific objectives of the morphological module in the general perspective of automated Natural Language Processing.
"Explorations in automated language classification". Folia Linguistica. 42 (2): 331–354.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
If A={a} and B={b}, select all strings that belongs to (A ⊗ B)+ A penalty will be applied for any wrong answers selected.
b ) = ( λ a . λ b . a ) ( λ a .
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
If A={a} and B={b}, select all strings that belongs to (A ⊗ B)+ A penalty will be applied for any wrong answers selected.
*?b would match first "ab" in "ababab", where a. *b would match the entire string. If the U flag is set, then quantifiers are ungreedy (lazy) by default, while ? makes them greedy.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the following context-free grammar \(G\) (where \(\text{S}\) is the top-level symbol): \(R_{01}: \text{S} \rightarrow \text{NP VP}\) \(R_{02}: \text{NP} \rightarrow \text{NP0}\) \(R_{03}: \text{NP} \rightarrow \text{Det NP0}\) \(R_{04}: \text{NP0} \rightarrow \text{N}\) \(R_{05}: \text{NP0} \rightarrow \text{...
The grammar G = ( { S , A , B , C , D } , { a , b , c } , R , S ) {\displaystyle G=(\{S,A,B,C,D\},\{a,b,c\},R,S)} , with productions S → A B & D C {\displaystyle S\rightarrow AB\&DC} , A → a A | ϵ {\displaystyle A\rightarrow aA\ |\ \epsilon } , B → b B c | ϵ {\displaystyle B\rightarrow bBc\ |\ \epsilon } , C → c C | ϵ ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider the following context-free grammar \(G\) (where \(\text{S}\) is the top-level symbol): \(R_{01}: \text{S} \rightarrow \text{NP VP}\) \(R_{02}: \text{NP} \rightarrow \text{NP0}\) \(R_{03}: \text{NP} \rightarrow \text{Det NP0}\) \(R_{04}: \text{NP0} \rightarrow \text{N}\) \(R_{05}: \text{NP0} \rightarrow \text{...
This is an example grammar: S ⟶ NP VP VP ⟶ VP PP VP ⟶ V NP VP ⟶ eats PP ⟶ P NP NP ⟶ Det N NP ⟶ she V ⟶ eats P ⟶ with N ⟶ fish N ⟶ fork Det ⟶ a {\displaystyle {\begin{aligned}{\ce {S}}&\ {\ce {->NP\ VP}}\\{\ce {VP}}&\ {\ce {->VP\ PP}}\\{\ce {VP}}&\ {\ce {->V\ NP}}\\{\ce {VP}}&\ {\ce {->eats}}\\{\ce {PP}}&\ {\ce {->P\ NP...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
The pulsed operation of lasers refers to any laser not classified as a continuous wave so that the optical power appears in pulses of some duration at some repetition rate. This encompasses a wide range of technologies addressing many different motivations. Some lasers are pulsed simply because they cannot be run in co...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Pulsed operation of lasers refers to any laser not classified as continuous wave, so that the optical power appears in pulses of some duration at some repetition rate. This encompasses a wide range of technologies addressing a number of different motivations. Some lasers are pulsed simply because they cannot be run in ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Provide a precise definition of concatenative morphology and illustrate your answer with concrete examples in English or French. Is this type of morphology relevant for all languages? More generally, is morphology of the same complexity for all languages?
Nonconcatenative morphology, also called discontinuous morphology and introflection, is a form of word formation and inflection in which the root is modified and which does not involve stringing morphemes together sequentially.
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Provide a precise definition of concatenative morphology and illustrate your answer with concrete examples in English or French. Is this type of morphology relevant for all languages? More generally, is morphology of the same complexity for all languages?
Nonconcatenative morphology is extremely well developed in the Semitic languages in which it forms the basis of virtually all higher-level word formation (as with the example given in the diagram). That is especially pronounced in Arabic, which also uses it to form approximately 41% of plurals in what is often called t...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
During the evaluation of WSD systems two main performance measures are used: Precision: the fraction of system assignments made that are correct Recall: the fraction of total word instances correctly assigned by a systemIf a system makes an assignment for every word, then precision and recall are the same, and can be c...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
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...
Precision and recall are single-value metrics based on the whole list of documents returned by the system. For systems that return a ranked sequence of documents, it is desirable to also consider the order in which the returned documents are presented. By computing a precision and recall at every position in the ranked...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
You are responsible for a project aiming at providing on-line recommendations to the customers of a on-line book selling company. The general idea behind this recommendation system is to cluster books according to both customers and content similarities, so as to propose books similar to the books already bought by a g...
One key choice for researchers when applying unsupervised methods is selecting the number of categories to sort documents into rather than defining what the categories are in advance. Single membership models: these models automatically cluster texts into different categories that are mutually exclusive, and documents ...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
You are responsible for a project aiming at providing on-line recommendations to the customers of a on-line book selling company. The general idea behind this recommendation system is to cluster books according to both customers and content similarities, so as to propose books similar to the books already bought by a g...
A number of canonical tasks are associated with statistical relational learning, the most common ones being. collective classification, i.e. the (simultaneous) prediction of the class of several objects given objects' attributes and their relations link prediction, i.e. predicting whether or not two or more objects are...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Many general evaluation metrics can be considered for various NLP tasks. The simplest one is accuracy. Give several examples of NLP tasks for which accuracy can be used as an evaluation metric. Justify why. In general, what property(ies) must an NLP task satisfy in order to be evaluable through accuracy?
Human ratings: give the generated text to a person, and ask them to rate the quality and usefulness of the text. Metrics: compare generated texts to texts written by people from the same input data, using an automatic metric such as BLEU, METEOR, ROUGE and LEPOR.An ultimate goal is how useful NLG systems are at helping...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Many general evaluation metrics can be considered for various NLP tasks. The simplest one is accuracy. Give several examples of NLP tasks for which accuracy can be used as an evaluation metric. Justify why. In general, what property(ies) must an NLP task satisfy in order to be evaluable through accuracy?
Human ratings: give the generated text to a person, and ask them to rate the quality and usefulness of the text. Metrics: compare generated texts to texts written by people from the same input data, using an automatic metric such as BLEU, METEOR, ROUGE and LEPOR.An ultimate goal is how useful NLG systems are at helping...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
The goal of this question is to illustrate how to use transducers to implement a simplified version of the conjugation of English verbs. We will restrict to the conjugated forms corresponding to the indicative mode and the present tense. Formally, this can be modeled as defining a transducer able to recognize associati...
For verbs, the endings in the present tense are given as -va, -ta, -ta. The table below shows a comparison of the conjugation of the verb delati, which means "to do, to make, to work" and belongs to Class IV in the singular, dual, and plural. In the imperative, the endings are given as -iva for the first-person dual an...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
The goal of this question is to illustrate how to use transducers to implement a simplified version of the conjugation of English verbs. We will restrict to the conjugated forms corresponding to the indicative mode and the present tense. Formally, this can be modeled as defining a transducer able to recognize associati...
The fourth conjugation is characterized by the vowel ī and can be recognized by the -īre ending of the present active infinitive. Deponent verbs have the infinitive -īrī: Other forms: Infinitive: audīre "to hear" Passive infinitive: audīrī "to be heard" Imperative: audī! (pl. audīte!)
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider using a parser with the following (partial) grammar: S -> NP VP VP -> V NP -> Det N VP -> VP PP NP -> N VP -> VBP VBG PP NP -> NP PP PP -> P NP and (also partial) lexicon: 2012 N from P Switzerland N in P USA N increasing VBG are VBP the Det exports N to P exports V Using the CYK algorithm, parse the follo...
This is an example grammar: S ⟶ NP VP VP ⟶ VP PP VP ⟶ V NP VP ⟶ eats PP ⟶ P NP NP ⟶ Det N NP ⟶ she V ⟶ eats P ⟶ with N ⟶ fish N ⟶ fork Det ⟶ a {\displaystyle {\begin{aligned}{\ce {S}}&\ {\ce {->NP\ VP}}\\{\ce {VP}}&\ {\ce {->VP\ PP}}\\{\ce {VP}}&\ {\ce {->V\ NP}}\\{\ce {VP}}&\ {\ce {->eats}}\\{\ce {PP}}&\ {\ce {->P\ NP...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus
Consider using a parser with the following (partial) grammar: S -> NP VP VP -> V NP -> Det N VP -> VP PP NP -> N VP -> VBP VBG PP NP -> NP PP PP -> P NP and (also partial) lexicon: 2012 N from P Switzerland N in P USA N increasing VBG are VBP the Det exports N to P exports V Using the CYK algorithm, parse the follo...
Rules representing regular German sentence structure.And finally, we need rules according to which one can relate these two structures together. Accordingly, we can state the following stages of translation: 1st: getting basic part-of-speech information of each source word:a = indef.article; girl = noun; eats = verb; a...
https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus