mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-26 17:13:17 +00:00
bump version to 0.1.14
This commit is contained in:
parent
eb8b7afea4
commit
d3752a0d76
5 changed files with 147 additions and 7 deletions
145
GALLERY.md
145
GALLERY.md
|
|
@ -23,6 +23,7 @@ This gallery shows examples from all available datasets using their default conf
|
||||||
- [group_anagrams](#group_anagrams)
|
- [group_anagrams](#group_anagrams)
|
||||||
- [gsm_symbolic](#gsm_symbolic)
|
- [gsm_symbolic](#gsm_symbolic)
|
||||||
- [intermediate_integration](#intermediate_integration)
|
- [intermediate_integration](#intermediate_integration)
|
||||||
|
- [isomorphic_strings](#isomorphic_strings)
|
||||||
- [largest_island](#largest_island)
|
- [largest_island](#largest_island)
|
||||||
- [lcm](#lcm)
|
- [lcm](#lcm)
|
||||||
- [leg_counting](#leg_counting)
|
- [leg_counting](#leg_counting)
|
||||||
|
|
@ -41,6 +42,7 @@ This gallery shows examples from all available datasets using their default conf
|
||||||
- [propositional_logic](#propositional_logic)
|
- [propositional_logic](#propositional_logic)
|
||||||
- [quantum_lock](#quantum_lock)
|
- [quantum_lock](#quantum_lock)
|
||||||
- [rubiks_cube](#rubiks_cube)
|
- [rubiks_cube](#rubiks_cube)
|
||||||
|
- [self_reference](#self_reference)
|
||||||
- [sentence_reordering](#sentence_reordering)
|
- [sentence_reordering](#sentence_reordering)
|
||||||
- [simple_equations](#simple_equations)
|
- [simple_equations](#simple_equations)
|
||||||
- [simple_geometry](#simple_geometry)
|
- [simple_geometry](#simple_geometry)
|
||||||
|
|
@ -1072,6 +1074,99 @@ Metadata: {'integrand': '2*asin(x)', 'problem_type': 'by_parts', 'variable': 'x'
|
||||||
|
|
||||||
````
|
````
|
||||||
|
|
||||||
|
### isomorphic_strings
|
||||||
|
Generates Isomorphic Strings exercises with configurable difficulty
|
||||||
|
|
||||||
|
Default configuration:
|
||||||
|
```python
|
||||||
|
max_string_length = 10
|
||||||
|
p_solvable = 0.5
|
||||||
|
size = 500
|
||||||
|
seed = 42
|
||||||
|
```
|
||||||
|
|
||||||
|
Example tasks:
|
||||||
|
````
|
||||||
|
Example 1:
|
||||||
|
Question: Two strings are isomorphic if the characters in one string can be replaced to get the second string.
|
||||||
|
|
||||||
|
All occurrences of a character must be replaced with another character while preserving the order of characters.
|
||||||
|
|
||||||
|
No two characters may map to the same character, but a character may map to itself.
|
||||||
|
|
||||||
|
Example 1:
|
||||||
|
Input: egg add
|
||||||
|
Output: True
|
||||||
|
Explanation: The strings s and t can be made identical by:
|
||||||
|
- Mapping 'e' to 'a'.
|
||||||
|
- Mapping 'g' to 'd'.
|
||||||
|
|
||||||
|
Example 2:
|
||||||
|
Input: foo bar
|
||||||
|
Output: False
|
||||||
|
Explanation:
|
||||||
|
- The strings cannot be made identical as 'o' needs to be mapped to both 'a' and 'r'.
|
||||||
|
|
||||||
|
Return True if the following two strings are isomorphic, or False otherwise:
|
||||||
|
cc bw
|
||||||
|
|
||||||
|
Answer: False
|
||||||
|
Metadata: {'words': ['cc', 'bw'], 'solution': False, 'solvable': False}
|
||||||
|
|
||||||
|
Example 2:
|
||||||
|
Question: Two strings are isomorphic if the characters in one string can be replaced to get the second string.
|
||||||
|
|
||||||
|
All occurrences of a character must be replaced with another character while preserving the order of characters.
|
||||||
|
|
||||||
|
No two characters may map to the same character, but a character may map to itself.
|
||||||
|
|
||||||
|
Example 1:
|
||||||
|
Input: egg add
|
||||||
|
Output: True
|
||||||
|
Explanation: The strings s and t can be made identical by:
|
||||||
|
- Mapping 'e' to 'a'.
|
||||||
|
- Mapping 'g' to 'd'.
|
||||||
|
|
||||||
|
Example 2:
|
||||||
|
Input: foo bar
|
||||||
|
Output: False
|
||||||
|
Explanation:
|
||||||
|
- The strings cannot be made identical as 'o' needs to be mapped to both 'a' and 'r'.
|
||||||
|
|
||||||
|
Return True if the following two strings are isomorphic, or False otherwise:
|
||||||
|
nai oik
|
||||||
|
|
||||||
|
Answer: True
|
||||||
|
Metadata: {'words': ['nai', 'oik'], 'solution': True, 'solvable': True}
|
||||||
|
|
||||||
|
Example 3:
|
||||||
|
Question: Two strings are isomorphic if the characters in one string can be replaced to get the second string.
|
||||||
|
|
||||||
|
All occurrences of a character must be replaced with another character while preserving the order of characters.
|
||||||
|
|
||||||
|
No two characters may map to the same character, but a character may map to itself.
|
||||||
|
|
||||||
|
Example 1:
|
||||||
|
Input: egg add
|
||||||
|
Output: True
|
||||||
|
Explanation: The strings s and t can be made identical by:
|
||||||
|
- Mapping 'e' to 'a'.
|
||||||
|
- Mapping 'g' to 'd'.
|
||||||
|
|
||||||
|
Example 2:
|
||||||
|
Input: foo bar
|
||||||
|
Output: False
|
||||||
|
Explanation:
|
||||||
|
- The strings cannot be made identical as 'o' needs to be mapped to both 'a' and 'r'.
|
||||||
|
|
||||||
|
Return True if the following two strings are isomorphic, or False otherwise:
|
||||||
|
hogtytyof kgqwfwfgh
|
||||||
|
|
||||||
|
Answer: True
|
||||||
|
Metadata: {'words': ['hogtytyof', 'kgqwfwfgh'], 'solution': True, 'solvable': True}
|
||||||
|
|
||||||
|
````
|
||||||
|
|
||||||
### largest_island
|
### largest_island
|
||||||
Generates Largest Island exercises with configurable difficulty
|
Generates Largest Island exercises with configurable difficulty
|
||||||
|
|
||||||
|
|
@ -1933,6 +2028,56 @@ Metadata: {'cube_size': 3, 'scramble_steps': 3, 'scramble_moves': "U R' R'", 'ex
|
||||||
|
|
||||||
````
|
````
|
||||||
|
|
||||||
|
### self_reference
|
||||||
|
Generates self-referential puzzles
|
||||||
|
|
||||||
|
Default configuration:
|
||||||
|
```python
|
||||||
|
difficulty = 5
|
||||||
|
seed = 42
|
||||||
|
size = 500
|
||||||
|
```
|
||||||
|
|
||||||
|
Example tasks:
|
||||||
|
````
|
||||||
|
Example 1:
|
||||||
|
Question: Given the truthfulness of these statements, please tell me the number of possible solutions:
|
||||||
|
- Statement 1: 'At least 1 of these 7 statements are true.'
|
||||||
|
- Statement 2: 'At most 3 of these 7 statements are false.'
|
||||||
|
- Statement 3: 'Exactly 4 of these 7 statements are true.'
|
||||||
|
- Statement 4: 'Exactly 3 of these 7 statements are false.'
|
||||||
|
- Statement 5: 'Either Statement 3 or Statement 4 is true, but not both.'
|
||||||
|
- Statement 6: 'The number of true statements is a prime number.'
|
||||||
|
- Statement 7: 'The number of false statements is a composite number.'
|
||||||
|
|
||||||
|
Answer: 4
|
||||||
|
|
||||||
|
Example 2:
|
||||||
|
Question: Given the truthfulness of these statements, please tell me the number of possible solutions:
|
||||||
|
- Statement 1: 'At least 4 of these 7 statements are true.'
|
||||||
|
- Statement 2: 'At most 5 of these 7 statements are false.'
|
||||||
|
- Statement 3: 'Exactly 7 of these 7 statements are true.'
|
||||||
|
- Statement 4: 'Exactly 1 of these 7 statements are false.'
|
||||||
|
- Statement 5: 'Either Statement 3 or Statement 4 is true, but not both.'
|
||||||
|
- Statement 6: 'The number of true statements is a prime number.'
|
||||||
|
- Statement 7: 'The number of false statements is a composite number.'
|
||||||
|
|
||||||
|
Answer: 4
|
||||||
|
|
||||||
|
Example 3:
|
||||||
|
Question: Given the truthfulness of these statements, please tell me the number of possible solutions:
|
||||||
|
- Statement 1: 'At least 2 of these 7 statements are true.'
|
||||||
|
- Statement 2: 'At most 5 of these 7 statements are false.'
|
||||||
|
- Statement 3: 'Exactly 0 of these 7 statements are true.'
|
||||||
|
- Statement 4: 'Exactly 3 of these 7 statements are false.'
|
||||||
|
- Statement 5: 'Either Statement 3 or Statement 4 is true, but not both.'
|
||||||
|
- Statement 6: 'The number of true statements is a prime number.'
|
||||||
|
- Statement 7: 'The number of false statements is a composite number.'
|
||||||
|
|
||||||
|
Answer: 2
|
||||||
|
|
||||||
|
````
|
||||||
|
|
||||||
### sentence_reordering
|
### sentence_reordering
|
||||||
Generates sentence reordering tasks from text spans
|
Generates sentence reordering tasks from text spans
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "reasoning_gym"
|
name = "reasoning_gym"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Open-Thought community", email = "andreas.koepf@xamla.com" },
|
{ name = "Open-Thought community", email = "andreas.koepf@xamla.com" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Reasoning Gym - A library of procedural dataset generators for training reasonin
|
||||||
from . import algebra, algorithmic, arithmetic, code, cognition, data, games, geometry, graphs, logic
|
from . import algebra, algorithmic, arithmetic, code, cognition, data, games, geometry, graphs, logic
|
||||||
from .factory import create_dataset, register_dataset
|
from .factory import create_dataset, register_dataset
|
||||||
|
|
||||||
__version__ = "0.1.3"
|
__version__ = "0.1.4"
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"algebra",
|
"algebra",
|
||||||
"algorithmic",
|
"algorithmic",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ from random import Random
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
from ..factory import ProceduralDataset, register_dataset
|
from ..factory import ProceduralDataset, register_dataset
|
||||||
from .contrib.logic_puzzle.generate import generate_puzzle
|
|
||||||
|
|
||||||
|
|
||||||
def is_prime(n):
|
def is_prime(n):
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,6 @@ def test_complex_arithmetic_basic():
|
||||||
# answer is formatted as "real + imagi"
|
# answer is formatted as "real + imagi"
|
||||||
assert ComplexArithmeticDataset.parse_string_to_complex(item["answer"]) == complex(*item["metadata"]["result"])
|
assert ComplexArithmeticDataset.parse_string_to_complex(item["answer"]) == complex(*item["metadata"]["result"])
|
||||||
|
|
||||||
with open("complex_arithmetic_dataset.txt", "w") as f:
|
|
||||||
for item in dataset:
|
|
||||||
f.write(str(item) + "\n")
|
|
||||||
|
|
||||||
|
|
||||||
def test_complex_arithmetic_scoring():
|
def test_complex_arithmetic_scoring():
|
||||||
"""Test scoring function with various answer formats and accuracies."""
|
"""Test scoring function with various answer formats and accuracies."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue