turingbot 3.3.0__tar.gz → 4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {turingbot-3.3.0 → turingbot-4.0}/LICENSE +1 -1
- turingbot-4.0/PKG-INFO +119 -0
- turingbot-4.0/README.md +95 -0
- {turingbot-3.3.0 → turingbot-4.0}/pyproject.toml +7 -3
- turingbot-4.0/turingbot/__init__.py +4 -0
- turingbot-4.0/turingbot/turingbot.py +1447 -0
- turingbot-4.0/turingbot.egg-info/PKG-INFO +119 -0
- turingbot-3.3.0/PKG-INFO +0 -193
- turingbot-3.3.0/README.md +0 -169
- turingbot-3.3.0/turingbot/__init__.py +0 -4
- turingbot-3.3.0/turingbot/turingbot.py +0 -450
- turingbot-3.3.0/turingbot.egg-info/PKG-INFO +0 -193
- {turingbot-3.3.0 → turingbot-4.0}/setup.cfg +0 -0
- {turingbot-3.3.0 → turingbot-4.0}/turingbot.egg-info/SOURCES.txt +0 -0
- {turingbot-3.3.0 → turingbot-4.0}/turingbot.egg-info/dependency_links.txt +0 -0
- {turingbot-3.3.0 → turingbot-4.0}/turingbot.egg-info/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2020-2026 TuringBot Software. All rights reserved.
|
|
2
2
|
|
|
3
3
|
Permission is granted to use this software solely in conjunction with a
|
|
4
4
|
licensed installation of TuringBot. Redistribution, modification, or use
|
turingbot-4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: turingbot
|
|
3
|
+
Version: 4.0
|
|
4
|
+
Summary: Symbolic regression in Python: find the mathematical formula behind your data with TuringBot
|
|
5
|
+
Author: TuringBot Software
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Homepage, https://turingbotsoftware.com
|
|
8
|
+
Project-URL: Documentation, https://turingbotsoftware.com/documentation.html
|
|
9
|
+
Project-URL: Repository, https://github.com/turingbotsoftware/turingbot-python
|
|
10
|
+
Project-URL: Download, https://turingbotsoftware.com/download.html
|
|
11
|
+
Keywords: symbolic regression,equation discovery,machine learning,interpretable machine learning,curve fitting,scikit-learn,scientific computing,simulated annealing
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Education
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# TuringBot Python Library
|
|
26
|
+
|
|
27
|
+
Python interface to [TuringBot](https://turingbotsoftware.com), a symbolic regression engine: it searches for explicit formulas that fit your data, and returns the most accurate formula found for each size.
|
|
28
|
+
|
|
29
|
+
The engine is compiled C++ and uses simulated annealing. There is no language runtime to set up and no GUI involved, so searches run the same in a notebook, over SSH or on a headless server. Input can be a CSV file, a numpy array or a pandas DataFrame.
|
|
30
|
+
|
|
31
|
+
Coming from PySR? [`TuringBotRegressor`](#coming-from-pysr) uses the same API as `PySRRegressor`.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install turingbot
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The engine comes with the TuringBot application: [download it](https://turingbotsoftware.com/download.html) and install it. The library needs Python 3.7 or newer and has no dependencies.
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import time
|
|
45
|
+
import numpy as np
|
|
46
|
+
from turingbot import simulation
|
|
47
|
+
|
|
48
|
+
x = np.linspace(-3, 3, 100)
|
|
49
|
+
data = np.column_stack([x, 2.5 * np.sin(x) + x ** 2]) # the last column is the target
|
|
50
|
+
|
|
51
|
+
with simulation() as sim:
|
|
52
|
+
sim.start_process(input_file=data, column_names=["x", "y"])
|
|
53
|
+
time.sleep(10)
|
|
54
|
+
sim.refresh_functions()
|
|
55
|
+
for f in sim.functions:
|
|
56
|
+
print(f)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
[1, 3.27574, '3.0606060606060477']
|
|
61
|
+
[3, 1.79969, 'x*x']
|
|
62
|
+
[5, 1.03435, 'x*(0.8418349138360374+x)']
|
|
63
|
+
[8, 0.93293, 'asinh(x)+x*x']
|
|
64
|
+
[10, 0.0, '2.5*sin(x)+x*x']
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Each line is `[size, error, formula]`, the Pareto front of size versus error, from the simplest formula to the most accurate. Here, the last one is the formula that generated the data.
|
|
68
|
+
|
|
69
|
+
The search runs in a background process. `refresh_functions()` reads the current front at any time, and the search stops at `terminate_process()` or when the `with` block exits.
|
|
70
|
+
|
|
71
|
+
`input_file` also takes the path of a CSV or TXT file, or a pandas DataFrame; the last column is the target. TuringBot is found in its default install location; otherwise, pass its path with `path=`. On a Linux server, that can be the AppImage, which needs no installation.
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- **Custom search metrics**, which can reference dataset columns, for example a weight column `w`: `custom_metric="sum(w*pow(actual-predicted,2))/sum(w)"`.
|
|
76
|
+
- **Custom functions and constants**, used as building blocks by the search: `custom_functions="bump(x)=exp(-x*x)"`, `custom_constants="g=9.81,c=299792458"`.
|
|
77
|
+
- **Time series**: `delay`, `moving_average` and `decay` give formulas access to past values of the inputs, and with `allow_target_delay=True`, of the target itself.
|
|
78
|
+
- **GUI and command line**: the same engine runs in the TuringBot desktop app and from the command line, with the same options.
|
|
79
|
+
|
|
80
|
+
## Search options
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
sim.start_process(
|
|
84
|
+
input_file="data.csv",
|
|
85
|
+
search_metric=4, # RMS error (the default)
|
|
86
|
+
allowed_functions="+ * / sin cos exp",
|
|
87
|
+
train_test_split=80, # 80% of the rows for training, 20% for testing
|
|
88
|
+
threads=4,
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
With `train_test_split`, each formula also has its error on the test rows: `[size, error, test_error, formula]`.
|
|
93
|
+
|
|
94
|
+
Every option, with the IDs of the 16 search metrics: `help(simulation.start_process)`, or the [documentation](https://turingbotsoftware.com/documentation.html#python).
|
|
95
|
+
|
|
96
|
+
## Coming from PySR
|
|
97
|
+
|
|
98
|
+
`TuringBotRegressor` follows the scikit-learn API and uses `PySRRegressor`'s names where the two match: `model_selection` (`"best"`, `"accuracy"` or `"score"`, with the same definitions), `equations_`, `sympy()`, `max_evals` and `early_stop_condition`. It works in pipelines, cross-validation and grid searches.
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from turingbot import TuringBotRegressor
|
|
102
|
+
|
|
103
|
+
model = TuringBotRegressor(max_time=30).fit(X, y)
|
|
104
|
+
print(model.equations_) # the formulas found, from the simplest to the most accurate
|
|
105
|
+
print(model.sympy()) # the chosen formula as a sympy expression
|
|
106
|
+
y_pred = model.predict(X_new)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
| PySRRegressor | TuringBotRegressor |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `niterations`, `timeout_in_seconds` | `max_time` (seconds) |
|
|
112
|
+
| `binary_operators`, `unary_operators` | `allowed_functions` |
|
|
113
|
+
| `maxsize` | `maximum_formula_complexity` |
|
|
114
|
+
|
|
115
|
+
It needs numpy. Its options are in `help(TuringBotRegressor)`.
|
|
116
|
+
|
|
117
|
+
## Citing
|
|
118
|
+
|
|
119
|
+
If you use TuringBot in your research, please cite it: [CITATION.cff](CITATION.cff) has the details, which GitHub also shows under "Cite this repository".
|
turingbot-4.0/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# TuringBot Python Library
|
|
2
|
+
|
|
3
|
+
Python interface to [TuringBot](https://turingbotsoftware.com), a symbolic regression engine: it searches for explicit formulas that fit your data, and returns the most accurate formula found for each size.
|
|
4
|
+
|
|
5
|
+
The engine is compiled C++ and uses simulated annealing. There is no language runtime to set up and no GUI involved, so searches run the same in a notebook, over SSH or on a headless server. Input can be a CSV file, a numpy array or a pandas DataFrame.
|
|
6
|
+
|
|
7
|
+
Coming from PySR? [`TuringBotRegressor`](#coming-from-pysr) uses the same API as `PySRRegressor`.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install turingbot
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The engine comes with the TuringBot application: [download it](https://turingbotsoftware.com/download.html) and install it. The library needs Python 3.7 or newer and has no dependencies.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import time
|
|
21
|
+
import numpy as np
|
|
22
|
+
from turingbot import simulation
|
|
23
|
+
|
|
24
|
+
x = np.linspace(-3, 3, 100)
|
|
25
|
+
data = np.column_stack([x, 2.5 * np.sin(x) + x ** 2]) # the last column is the target
|
|
26
|
+
|
|
27
|
+
with simulation() as sim:
|
|
28
|
+
sim.start_process(input_file=data, column_names=["x", "y"])
|
|
29
|
+
time.sleep(10)
|
|
30
|
+
sim.refresh_functions()
|
|
31
|
+
for f in sim.functions:
|
|
32
|
+
print(f)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
[1, 3.27574, '3.0606060606060477']
|
|
37
|
+
[3, 1.79969, 'x*x']
|
|
38
|
+
[5, 1.03435, 'x*(0.8418349138360374+x)']
|
|
39
|
+
[8, 0.93293, 'asinh(x)+x*x']
|
|
40
|
+
[10, 0.0, '2.5*sin(x)+x*x']
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Each line is `[size, error, formula]`, the Pareto front of size versus error, from the simplest formula to the most accurate. Here, the last one is the formula that generated the data.
|
|
44
|
+
|
|
45
|
+
The search runs in a background process. `refresh_functions()` reads the current front at any time, and the search stops at `terminate_process()` or when the `with` block exits.
|
|
46
|
+
|
|
47
|
+
`input_file` also takes the path of a CSV or TXT file, or a pandas DataFrame; the last column is the target. TuringBot is found in its default install location; otherwise, pass its path with `path=`. On a Linux server, that can be the AppImage, which needs no installation.
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
- **Custom search metrics**, which can reference dataset columns, for example a weight column `w`: `custom_metric="sum(w*pow(actual-predicted,2))/sum(w)"`.
|
|
52
|
+
- **Custom functions and constants**, used as building blocks by the search: `custom_functions="bump(x)=exp(-x*x)"`, `custom_constants="g=9.81,c=299792458"`.
|
|
53
|
+
- **Time series**: `delay`, `moving_average` and `decay` give formulas access to past values of the inputs, and with `allow_target_delay=True`, of the target itself.
|
|
54
|
+
- **GUI and command line**: the same engine runs in the TuringBot desktop app and from the command line, with the same options.
|
|
55
|
+
|
|
56
|
+
## Search options
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
sim.start_process(
|
|
60
|
+
input_file="data.csv",
|
|
61
|
+
search_metric=4, # RMS error (the default)
|
|
62
|
+
allowed_functions="+ * / sin cos exp",
|
|
63
|
+
train_test_split=80, # 80% of the rows for training, 20% for testing
|
|
64
|
+
threads=4,
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
With `train_test_split`, each formula also has its error on the test rows: `[size, error, test_error, formula]`.
|
|
69
|
+
|
|
70
|
+
Every option, with the IDs of the 16 search metrics: `help(simulation.start_process)`, or the [documentation](https://turingbotsoftware.com/documentation.html#python).
|
|
71
|
+
|
|
72
|
+
## Coming from PySR
|
|
73
|
+
|
|
74
|
+
`TuringBotRegressor` follows the scikit-learn API and uses `PySRRegressor`'s names where the two match: `model_selection` (`"best"`, `"accuracy"` or `"score"`, with the same definitions), `equations_`, `sympy()`, `max_evals` and `early_stop_condition`. It works in pipelines, cross-validation and grid searches.
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from turingbot import TuringBotRegressor
|
|
78
|
+
|
|
79
|
+
model = TuringBotRegressor(max_time=30).fit(X, y)
|
|
80
|
+
print(model.equations_) # the formulas found, from the simplest to the most accurate
|
|
81
|
+
print(model.sympy()) # the chosen formula as a sympy expression
|
|
82
|
+
y_pred = model.predict(X_new)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| PySRRegressor | TuringBotRegressor |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `niterations`, `timeout_in_seconds` | `max_time` (seconds) |
|
|
88
|
+
| `binary_operators`, `unary_operators` | `allowed_functions` |
|
|
89
|
+
| `maxsize` | `maximum_formula_complexity` |
|
|
90
|
+
|
|
91
|
+
It needs numpy. Its options are in `help(TuringBotRegressor)`.
|
|
92
|
+
|
|
93
|
+
## Citing
|
|
94
|
+
|
|
95
|
+
If you use TuringBot in your research, please cite it: [CITATION.cff](CITATION.cff) has the details, which GitHub also shows under "Cite this repository".
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "turingbot"
|
|
7
|
-
version = "
|
|
8
|
-
description = "
|
|
7
|
+
version = "4.0"
|
|
8
|
+
description = "Symbolic regression in Python: find the mathematical formula behind your data with TuringBot"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "LicenseRef-Proprietary"
|
|
11
11
|
requires-python = ">=3.7"
|
|
@@ -14,7 +14,11 @@ authors = [
|
|
|
14
14
|
]
|
|
15
15
|
keywords = [
|
|
16
16
|
"symbolic regression",
|
|
17
|
+
"equation discovery",
|
|
17
18
|
"machine learning",
|
|
19
|
+
"interpretable machine learning",
|
|
20
|
+
"curve fitting",
|
|
21
|
+
"scikit-learn",
|
|
18
22
|
"scientific computing",
|
|
19
23
|
"simulated annealing",
|
|
20
24
|
]
|