Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
dense
Generated from Trainer
dataset_size:2778
loss:MultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use Krelle/e5-small-v2-imo-pairs with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Krelle/e5-small-v2-imo-pairs with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Krelle/e5-small-v2-imo-pairs") sentences = [ "In the induction example for the sum $1+2+\\dots+n$, why do we add $n+1$ to both sides of (1.16)?", "Subsection 1.6.3: Subsets\n\n\n\nIf $A$ and $B$ are sets, then <footnote>$A\\subseteq B$->At times, the symbol $\\subset$ is used instead of $\\subseteq$. In our context these two symbols mean the same. However, the notation $A\\subsetneq B$ means that $A\\subseteq B$ and\n $A\\neq B$. For example,\n $\\{1, 2, 3\\} \\subseteq \\{1, 2, 3\\}$ and\n $\\{1, 2, 3\\} \\subset \\{1, 2, 3\\}$.</footnote> means that\nevery element of $A$ is an element of $B$. So $A\\subseteq B$ is a placeholder for the proposition\n$$\n\\forall x\\in A : x\\in B\n$$\n\nIn this case we say\nthat *$A$ is a subset of $B$*. We also use the notation $A\\subsetneq B$ to\nindicate that $A\\subseteq B$ and $A\\neq B$. In this case we say that\n$A$ is a *strict* subset of $B$.\n\n\nExercise 1.47:\n\nList the subsets of $\\{1, 2\\}$. How many are there?\n\n/Exercise\n\n\nExercise 1.48:\n\nIt turns out that the empty set $\\emptyset$ is a subset of any set.\n\n\n\nExplain why this is so using the definition of $\\subseteq$.\n\n\\begin{prompting}\nExplain precisely in terms of propositions and logic why the empty set is a subset of any given set.\n\\end{prompting}\n\n/Exercise\n\n\nExercise 1.49:\n\nBelow Sage (not python) will list all subsets of the set $\\{1, 2, 3\\}$. Before pressing\nthe Compute button, try to write them down on your own.\n\n\n\nList all the subsets of a set with five elements. In general, how many subsets does a set with $n$ elements have?\n\n/Exercise\n\n\nQuizexercise 1.50:\n\n\\begin{paragraphquiz}\n \\question\n The set \\box is not a subset of $A=$\\box, simply because \\box does not belong to $A$.\n This exercise actually has \\box possible correct solutions.\n\n\\answer\n $\\{1, 2, 3\\}$\n \\answer\n $\\{-1, 1, 2, 3, 4\\}$\n \\answer\n $\\{-1, 0, 1, 2, 4\\}$\n \\answer\n $3$\n \\answer\n $-1$\n \\answer\n $5$\n \\answer\n $6$\n \\answer\n $0$\n \\case{(is 1347)}{T} Correct!\n \\case{(is 2157)}{T} Correct!\n \\case{(is 2347)}{T} Correct!\n \\case{(is 3287)}{T} Correct!\n \\case{(is 3157)}{T} Correct!\n \\case{(is 3187)}{T} Correct!\n \\default\n Nope. Try again!\n\\end{paragraphquiz}\n\n/Quizexercise\n\n\nQuizexercise 1.51:\n\n\\begin{paragraphquiz}\n \\question\n The empty set has \\box elements. A set with \\box elements has \\box subsets. In general a set with\n $n$ elements has \\box subsets.\n \\answer\n $1$\n \\answer\n $0$\n \\answer\n $5$\n \\answer\n $25$\n \\answer\n $32$\n \\answer\n $n^2$\n \\answer\n $2^n$\n \\case{(is 2357)}{T}\n Correct!\n \\default\n Nope. Try again!\n\\end{paragraphquiz}\n\n/Quizexercise", "Section 1.8: Proof by induction\n\n\n\nA <footnote>precocious Gauss->See the article Gauss's Day of Reckoning: https://www.americanscientist.org/article/gausss-day-of-reckoning for some history of this anecdote.</footnote> proved the formula\n$$\n1 + 2 + \\cdots + n = \\frac{n(n+1)}{2}\n\\tag{1.15}$$\nat the age of seven displaying remarkable ingenuity for his age. Lesser\nmortals usually use induction to prove this formula. Gauss was asked\nalong with his classmates to compute the sum of all natural numbers\n$1, 2, \\dots, 100$. Using his formula he quickly came up with the correct\nanswer $5050$. His classmates had to work for the entire lesson. \n\nSuppose that the formula in (1.15) is viewed as a\nproposition $p(n)$. To prove the formula we need to prove it for all\nnatural numbers (you can easily see that $p(1)$ and $p(2)$ are true) i.e.,\nwe need to prove\n$$\n\\forall n\\in \\mathbb{N}: p(n).\n$$\nAn induction proof is a way of proving this statement by showing two things:\n\\begin{enumerate}\\item (i)\n $p(1)$\n\\item (ii)\n $\\forall n\\in \\mathbb{N}: p(n)\\implies p(n+1)$\n\\end{enumerate}\nThese two statements ensure that $p(1) \\implies p(2)$. Therefore\n$p(2)$ must be true, since we assumed $p(1)$ true from the\nbeginning. Similarly $p(2)\\implies p(3)$ ensures that $p(3)$\nis true and so on. In fact we have proved $p(n)$ for every $n\\in \\mathbb{N}$\nusing this technique. One can prove this using proof by\ncontradiction and that every non-empty subset\nof $\\mathbb{N}$ has a first element. In general if $S$ is a subset of set with an order $\\leq$, then\n$s\\in S$ is called a first element if\n$$\n\\forall x\\in S: s \\leq x.\n$$\nA crucial rule (or axiom) is that every non-empty subset of $\\mathbb{N}$ has\n a first element! Notice that this is false for $\\mathbb{Z}$.\n\n\nTheorem 1.82:\n\n Suppose that $p(n)$ are infinitely many propositions given by $n\\in \\mathbb{N}$. Then\n $$\n \\forall n\\in \\mathbb{N}: p(n)\n $$\n is true if\n\\begin{enumerate}\\item (i)\n $p(1)$ is true.\n\\item (ii)\n $\\left(\\forall n\\in \\mathbb{N}: p(n)\\implies p(n+1)\\right)$ is true.\n\\end{enumerate}\n\n/Theorem\n\n\\begin{proof}\nSuppose by contradiction that there exists $n\\in \\mathbb{N}$, such that\n$p(n)$ is false. Then the subset\n$$\nS = \\{n\\in \\mathbb{N} \\mid \\neg p(n)\\}\\subseteq \\mathbb{N}\n$$\nis non-empty. Therefore it has a first element $n_0\\in S$. \nHere $n_0 > 1$, since $p(1)$ is assumed to be true. So we\nknow that $p(n_0-1)$ is true and that\n$p(n_0-1)\\implies p(n_0)$ is true. But the latter\nimplication is a contradiction, since true implies\nfalse is false.\n\\end{proof}\n\n\n\nLet us see how an induction proof plays out in the above example\nwith the statement $p(n)$ that\n$$\n1 + 2 + \\cdots + n = \\frac{n(n+1)}{2}.\n\\tag{1.16}$$\nClearly $p(1)$ is true. We need to prove $p(n)\\implies p(n+1)$, so\nwe assume that $p(n)$ holds i.e., that (1.16) is true.\nThen we may add $n+1$ to both sides of (1.16) to get\n$$\n1 + 2 + \\cdots + n + (n+1) = \\frac{n(n+1)}{2} + (n+1).\n$$\nHere the right hand side can be rewritten as\n$$\n\\frac{n(n+1) + 2(n+1)}{2} = \\frac{(n+1)(n+2)}{2},\n$$\nwhich is exactly what we want. This is the conjectured formula for\nthe sum of the numbers $1, 2, \\dots, n, n+1$. Therefore\nwe have proved that $p(n)\\implies p(n+1)$ and the induction\nproof is complete.\n\n\nExample 1.83:\n\n For a real number $r\\neq 1$, the extremely useful formula\n $$\n 1 + r + \\cdots + r^n = \\frac{1 - r^{n+1}}{1-r}\n \\tag{1.17}$$\n holds. Let us prove this formula by induction. For $n=1$ this amounts to the identity\n $$\n 1 + r = \\frac{1-r^2}{1-r},\n $$\n which is true since $1-r^2 = (1+r)(1-r)$. We let $p(n)$ denote\n the identity in (1.17). We have seen that $p(1)$ is true. The induction step\n consists in proving $p(n)\\implies p(n+1)$. We can prove this\n by adding $r^{n+1}$ to the right hand side in (1.17):\n $$\n \\frac{1 - r^{n+1}}{1-r} + r^{n+1} = \\frac{1 - r^{n+1} + (1-r) r^{n+1}}{1-r} = \\frac{1 - r^{n+2}}{1-r}.\n \\tag{1.18}$$\nReal life application:\n In order to pay for a house you borrow $P$ DKK at an interest of\n $r$ per year. You want to pay off your debt over $N$ years by\n paying a fixed amount each year. How much is the fixed yearly\n amount you need to pay?\n\nLet us analyze the setup: suppose that the fixed yearly amount\n is $Y$. We will find an equation giving us $Y$ in terms of\n $P, N$ and $r$. Put $q = 1+ r$.\n\nAfter one year you owe\n $$\n q P - Y.\n $$\n After two years you owe\n $$\n q(q P - Y) - Y.\n $$\n After three years you owe\n $$\n q ( q ( q P - Y) - Y) - Y.\n $$\n In general after $n$ years you owe\n $$\n q^n P - Y (1 + q + \\cdots + q^{n-1}).\n $$\n Since we want to be debt free after $N$ years, the yearly payment will have to satisfy\n $$\n q^N P = Y ( 1 + q + \\cdots + q^{N-1}).\n $$\n By the formula (1.17), we get\n $$\n q^N P = Y \\frac{1-q^N}{1-q}.\n $$\n Here $Y$ can be isolated giving the formula\n $$\n Y = \\frac{r P}{1 - \\left(\\frac{1}{1+r}\\right)^N}.\n $$ \n With the current (August 2024) interest rate around four percent, you pay a fixed monthly\n amount of around 4770 DKK (down from 5420 DKK in 2023, when the interest rate was five percent) for borrowing one million DKK over $30$ years.\n \n \n\n/Example", "Subsection 1.9.5: Injective and surjective functions\n\n\n\nWe now define three very important notions related to functions.\n\n\nDefinition 1.101:\n\n Let $f: S\\rightarrow T$ be a function. Then $f$ is called\n \\begin{enumerate}\\item (i)\n *injective*, if $f(x) = f(y) \\implies x = y$ for every $x, y\\in S$.\n \\item (ii)\n *surjective*, if for every $y\\in T$, there exists $x\\in S$, such that $f(x) = y$.\n \\item (iii)\n *bijective*, if it is both injective and surjective.\n \\end{enumerate}\n\n/Definition\n\n\nExercise 1.102:\n\nIs a cryptographic hash-function as defined in Example (1.92) injective?\n\n/Exercise\n\n\nExercise 1.103:\n\nSuppose that\n$$\nS = \\{1, 2, 3\\}\\qquad\\text{and}\\qquad T = \\{1, 2, 3, 4\\}\n$$\nand that the function $f: S\\rightarrow T$ is defined by the table\n$$\n\\def\\arraystretch{1.5}\n\\begin{array}{c|ccccccc}\nx & 1 & 2 & 3\\\\ \\hline\nf(x) & 1 & 2 & 4\n\\end{array}\n$$\nIs $f$ injective? Is it surjective? Is it possible to adjust the table so that\n$f$ becomes injective?\nIs it possible to adjust the table so that\n$f$ becomes surjective?\n\n/Exercise\n\n\nExercise 1.104:\n\nConsider the function $f:S \\rightarrow T$ given by\n$$\nf(x) = x^2,\n$$\nwhere $S = T = \\mathbb{R}$.\nIs $f$ injective? Is $f$ surjective? Suggest how to change $S$ and $T$ so that $f:S\\rightarrow T$ becomes\nbijective.\n\n/Exercise\n\n\nExercise 1.105:\n\nConsider the function $f:\\mathbb{Z} \\rightarrow \\mathbb{Z}$ given by\n$$\nf(x) = x + 1\n$$\nShow that $f$ is bijective.\n\n/Exercise\n\n\nExercise 1.106:\n\nWrite down precisely how the truth table for $p\\implies q$ may\nbe expressed in terms of a function $f: S\\rightarrow T$. What are the sets $S$ and $T$ in this case?\n\n/Exercise\n\nSubsection 1.9.6: The inverse function\n\n\n\nIf $f:S\\rightarrow T$ is bijective, then we may define a function $g: T\\rightarrow S$, so\nthat $(f\\circ g)(y) = y$ for every $y\\in T$ and $(g\\circ f)(x)$ for every $x\\in S$. This\nfunction is denoted $f^{-1}$.\n\nHow do we define $f^{-1}(y)$ for $y\\in T$? Well, since $f$ is surjective, we may find\n$x\\in S$ so that $y = f(x)$. Now, we simply define\n$$\nf^{-1}(y) = x.\n\\tag{1.20}$$\nWe cannot have $x_1 \\neq x_2$ in $S$ with $f(x_1) = f(x_2) = y$, since $f$ is injective. We only have one choice for\n$x$ in (1.20). Therefore (1.20) really is a good and sound definition.\n\n\nExample 1.107:\n\nLet $f: S\\rightarrow S$, where $S = \\{1, 2, 3\\}$ be given by\nthe table\n$$\n\\def\\arraystretch{1.5}\n\\begin{array}{c|ccccccc}\nx & 1 & 2 & 3\\\\ \\hline\nf(x) & 3 & 1 & 2\n\\end{array}.\n$$\nThen $f^{-1}$is given by the table\n$$\n\\def\\arraystretch{1.5}\n\\begin{array}{c|ccccccc}\nx & 1 & 2 & 3\\\\ \\hline\nf^{-1}(x) & 2 & 3 & 1\n\\end{array}.\n$$\n\n/Example\n\n\nExercise 1.108:\n\nWhat if the definition of $f$ in Example (1.107) is changed to\n$$\n\\def\\arraystretch{1.5}\n\\begin{array}{c|ccccccc}\nx & 1 & 2 & 3\\\\ \\hline\nf(x) & 3 & 2 & 2\n\\end{array}.\n$$\nDoes $f^{-1}$ make sense here?\n\n/Exercise\n\n\nExercise 1.109:\n\nWhat is the inverse function of $f:\\mathbb{Z}\\rightarrow \\mathbb{Z}$ given by $f(x) = x + 1$?\nWhat is the inverse function of $g: S \\rightarrow S$, where $g(x) = \\sqrt{x}$ and\n$S = \\{x\\in \\mathbb{R}\\mid x\\geq 0\\}$?\n\n/Exercise" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Welcome to the community
The community tab is the place to discuss and collaborate with the HF community!