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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Mathematics Dataset
|
| 2 |
+
|
| 3 |
+
This dataset code generates mathematical question and answer pairs, from a range
|
| 4 |
+
of question types at roughly school-level difficulty. This is designed to test
|
| 5 |
+
the mathematical learning and algebraic reasoning skills of learning models.
|
| 6 |
+
|
| 7 |
+
Original paper: [Analysing Mathematical
|
| 8 |
+
Reasoning Abilities of Neural Models](https://openreview.net/pdf?id=H1gR5iR5FX)
|
| 9 |
+
(Saxton, Grefenstette, Hill, Kohli).
|
| 10 |
+
|
| 11 |
+
## Example questions
|
| 12 |
+
|
| 13 |
+
```
|
| 14 |
+
Question: Solve -42*r + 27*c = -1167 and 130*r + 4*c = 372 for r.
|
| 15 |
+
Answer: 4
|
| 16 |
+
|
| 17 |
+
Question: Calculate -841880142.544 + 411127.
|
| 18 |
+
Answer: -841469015.544
|
| 19 |
+
|
| 20 |
+
Question: Let x(g) = 9*g + 1. Let q(c) = 2*c + 1. Let f(i) = 3*i - 39. Let w(j) = q(x(j)). Calculate f(w(a)).
|
| 21 |
+
Answer: 54*a - 30
|
| 22 |
+
|
| 23 |
+
Question: Let e(l) = l - 6. Is 2 a factor of both e(9) and 2?
|
| 24 |
+
Answer: False
|
| 25 |
+
|
| 26 |
+
Question: Let u(n) = -n**3 - n**2. Let e(c) = -2*c**3 + c. Let l(j) = -118*e(j) + 54*u(j). What is the derivative of l(a)?
|
| 27 |
+
Answer: 546*a**2 - 108*a - 118
|
| 28 |
+
|
| 29 |
+
Question: Three letters picked without replacement from qqqkkklkqkkk. Give prob of sequence qql.
|
| 30 |
+
Answer: 1/110
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## Pre-generated data
|
| 34 |
+
|
| 35 |
+
[Pre-generated files](https://console.cloud.google.com/storage/browser/mathematics-dataset)
|
| 36 |
+
|
| 37 |
+
### Version 1.0
|
| 38 |
+
|
| 39 |
+
This is the version released with the original paper. It contains 2 million
|
| 40 |
+
(question, answer) pairs per module, with questions limited to 160 characters in
|
| 41 |
+
length, and answers to 30 characters in length. Note the training data for each
|
| 42 |
+
question type is split into "train-easy", "train-medium", and "train-hard". This
|
| 43 |
+
allows training models via a curriculum. The data can also be mixed together
|
| 44 |
+
uniformly from these training datasets to obtain the results reported in the
|
| 45 |
+
paper. Categories:
|
| 46 |
+
|
| 47 |
+
* **algebra** (linear equations, polynomial roots, sequences)
|
| 48 |
+
* **arithmetic** (pairwise operations and mixed expressions, surds)
|
| 49 |
+
* **calculus** (differentiation)
|
| 50 |
+
* **comparison** (closest numbers, pairwise comparisons, sorting)
|
| 51 |
+
* **measurement** (conversion, working with time)
|
| 52 |
+
* **numbers** (base conversion, remainders, common divisors and multiples,
|
| 53 |
+
primality, place value, rounding numbers)
|
| 54 |
+
* **polynomials** (addition, simplification, composition, evaluating, expansion)
|
| 55 |
+
* **probability** (sampling without replacement)
|
| 56 |
+
|
| 57 |
+
## Getting the source
|
| 58 |
+
|
| 59 |
+
### PyPI
|
| 60 |
+
|
| 61 |
+
The easiest way to get the source is to use pip:
|
| 62 |
+
|
| 63 |
+
```shell
|
| 64 |
+
$ pip install mathematics_dataset
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### From GitHub
|
| 68 |
+
|
| 69 |
+
Alternately you can get the source by cloning the mathematics_dataset
|
| 70 |
+
repository:
|
| 71 |
+
|
| 72 |
+
```shell
|
| 73 |
+
$ git clone https://github.com/deepmind/mathematics_dataset
|
| 74 |
+
$ pip install --upgrade mathematics_dataset/
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Generating examples
|
| 78 |
+
|
| 79 |
+
Generated examples can be printed to stdout via the `generate` script. For
|
| 80 |
+
example:
|
| 81 |
+
|
| 82 |
+
```shell
|
| 83 |
+
python -m mathematics_dataset.generate --filter=linear_1d
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
will generate example (question, answer) pairs for solving linear equations in
|
| 87 |
+
one variable.
|
| 88 |
+
|
| 89 |
+
We've also included `generate_to_file.py` as an example of how to write the
|
| 90 |
+
generated examples to text files. You can use this directly, or adapt it for
|
| 91 |
+
your generation and training needs.
|
| 92 |
+
|
| 93 |
+
## Dataset Metadata
|
| 94 |
+
The following table is necessary for this dataset to be indexed by search
|
| 95 |
+
engines such as <a href="https://g.co/datasetsearch">Google Dataset Search</a>.
|
| 96 |
+
<div itemscope itemtype="http://schema.org/Dataset">
|
| 97 |
+
<table>
|
| 98 |
+
<tr>
|
| 99 |
+
<th>property</th>
|
| 100 |
+
<th>value</th>
|
| 101 |
+
</tr>
|
| 102 |
+
<tr>
|
| 103 |
+
<td>name</td>
|
| 104 |
+
<td><code itemprop="name">Mathematics Dataset</code></td>
|
| 105 |
+
</tr>
|
| 106 |
+
<tr>
|
| 107 |
+
<td>url</td>
|
| 108 |
+
<td><code itemprop="url">https://github.com/deepmind/mathematics_dataset</code></td>
|
| 109 |
+
</tr>
|
| 110 |
+
<tr>
|
| 111 |
+
<td>sameAs</td>
|
| 112 |
+
<td><code itemprop="sameAs">https://github.com/deepmind/mathematics_dataset</code></td>
|
| 113 |
+
</tr>
|
| 114 |
+
<tr>
|
| 115 |
+
<td>description</td>
|
| 116 |
+
<td><code itemprop="description">This dataset consists of mathematical question and answer pairs, from a range
|
| 117 |
+
of question types at roughly school-level difficulty. This is designed to test
|
| 118 |
+
the mathematical learning and algebraic reasoning skills of learning models.\n
|
| 119 |
+
\n
|
| 120 |
+
## Example questions\n
|
| 121 |
+
\n
|
| 122 |
+
```\n
|
| 123 |
+
Question: Solve -42*r + 27*c = -1167 and 130*r + 4*c = 372 for r.\n
|
| 124 |
+
Answer: 4\n
|
| 125 |
+
\n
|
| 126 |
+
Question: Calculate -841880142.544 + 411127.\n
|
| 127 |
+
Answer: -841469015.544\n
|
| 128 |
+
\n
|
| 129 |
+
Question: Let x(g) = 9*g + 1. Let q(c) = 2*c + 1. Let f(i) = 3*i - 39. Let w(j) = q(x(j)). Calculate f(w(a)).\n
|
| 130 |
+
Answer: 54*a - 30\n
|
| 131 |
+
```\n
|
| 132 |
+
\n
|
| 133 |
+
It contains 2 million
|
| 134 |
+
(question, answer) pairs per module, with questions limited to 160 characters in
|
| 135 |
+
length, and answers to 30 characters in length. Note the training data for each
|
| 136 |
+
question type is split into "train-easy", "train-medium", and "train-hard". This
|
| 137 |
+
allows training models via a curriculum. The data can also be mixed together
|
| 138 |
+
uniformly from these training datasets to obtain the results reported in the
|
| 139 |
+
paper. Categories:\n
|
| 140 |
+
\n
|
| 141 |
+
* **algebra** (linear equations, polynomial roots, sequences)\n
|
| 142 |
+
* **arithmetic** (pairwise operations and mixed expressions, surds)\n
|
| 143 |
+
* **calculus** (differentiation)\n
|
| 144 |
+
* **comparison** (closest numbers, pairwise comparisons, sorting)\n
|
| 145 |
+
* **measurement** (conversion, working with time)\n
|
| 146 |
+
* **numbers** (base conversion, remainders, common divisors and multiples,\n
|
| 147 |
+
primality, place value, rounding numbers)\n
|
| 148 |
+
* **polynomials** (addition, simplification, composition, evaluating, expansion)\n
|
| 149 |
+
* **probability** (sampling without replacement)</code></td>
|
| 150 |
+
</tr>
|
| 151 |
+
<tr>
|
| 152 |
+
<td>provider</td>
|
| 153 |
+
<td>
|
| 154 |
+
<div itemscope itemtype="http://schema.org/Organization" itemprop="provider">
|
| 155 |
+
<table>
|
| 156 |
+
<tr>
|
| 157 |
+
<th>property</th>
|
| 158 |
+
<th>value</th>
|
| 159 |
+
</tr>
|
| 160 |
+
<tr>
|
| 161 |
+
<td>name</td>
|
| 162 |
+
<td><code itemprop="name">DeepMind</code></td>
|
| 163 |
+
</tr>
|
| 164 |
+
<tr>
|
| 165 |
+
<td>sameAs</td>
|
| 166 |
+
<td><code itemprop="sameAs">https://en.wikipedia.org/wiki/DeepMind</code></td>
|
| 167 |
+
</tr>
|
| 168 |
+
</table>
|
| 169 |
+
</div>
|
| 170 |
+
</td>
|
| 171 |
+
</tr>
|
| 172 |
+
<tr>
|
| 173 |
+
<td>citation</td>
|
| 174 |
+
<td><code itemprop="citation">https://identifiers.org/arxiv:1904.01557</code></td>
|
| 175 |
+
</tr>
|
| 176 |
+
</table>
|
| 177 |
+
</div>
|