### A regression model example and how to generate it

In this example, we use symbolic regression to predict house prices as a function of their characteristics.

Say you want to predict a numerical value from a set of input variables. In 2022, most people would go about it in one of two ways:

- Fit a line or a polynomial to the data.
- Use some horribly complicated black-box method (neural networks, random forests, etc).

The first option is very limited. It barely scratches the space of all possible mathematical relationships that could be relevant.

The second option yields models that are highly susceptible to overfitting and that do not offer much insight into the data.

This is where TuringBot comes in: it solves the problem by finding explicit mathematical formulas that connect the variables. This way, it generalizes curve-fitting methods (including linear and polynomial regression), while generating models that are simple and explainable.

TuringBot implements a technique called Symbolic Regression. It tries to combine a set of base functions into simple formulas that accurately predict the desired variable. The base functions offered by the program are the following:

**Arithmetic:**addition, multiplication, division**Trigonometric:**sin, cos, tan, asin, acos, atan**Exponential:**exp, log, log2, sqrt, pow**Hyperbolic:**sinh, cosh, tanh, asinh, acosh, atanh**Logical:**smaller, greater, equal, different, logical_or, logical_and**History:**delay, moving_average**Other:**abs, floor, ceil, round, sign, mod, gamma, erf

What is optimized is the formula itself, and not just the numerical constants of some assumed model.

The program uses TXT or CSV files as input, which may contain an arbitrary number of columns. It can be executed both interactively through its powerful graphical interface, or in an automated way from the command line.

Here is an example of an input file that you can use: input.txt.

If your problem involves predicting a number as a function of other numbers, then you can apply TuringBot to it. Just save the data in TXT or CSV format, load it in the program, and start the search.

To give a few concrete examples:

- Predict the price of a house as a function of its characteristics (area, number of bedrooms, age, etc): A regression model example and how to generate it.
- Detect fraudulent credit card transactions based on anonymized features: Using Symbolic Regression to predict rare events.
- Predict whether a stock will rise or fall in the next day: How to create an AI trading system.

Note that the last two examples are classification problems. This is not an issue: just find formulas that output 0 or 1 depending on the category.

A decision boundary found with symbolic regression. Tutorial

What makes TuringBot so general is that many different search metrics are included, allowing models with different goals to be generated. Those include:

- RMS error
- Classification accuracy
- Correlation coefficient
- Maximum error
- Mean error
- Mean relative error
- F1 score

Both TuringBot and Eureqa are implementations of Symbolic Regression, but the algorithms used by each are completely different. Eureqa is based on genetic programming, while TuringBot is based on Simulated Annealing.

Eureqa was acquired by a consulting company called DataRobot and is no longer commercially available.

A recent paper has shown that TuringBot performs noticeably better than Eureqa on a variety of Physics-inspired problems (arXiv:2010.11328). In this paper, TuringBot even managed to solve problems for which Eureqa could not find a solution at all.

Many free symbolic regression packages have been developed in the past, including notably gplearn but also many other small repositories that can be found on GitHub.

If you try any of these packages and compare the performance to TuringBot, you will instantly notice that their performance is vastly inferior. The main reasons for that are two:

- It is easy to write a basic symbolic regression software, but extremely difficult to write an efficient one. This results in many projects that have been started with great hopes, maintained for a few months, and then abandoned because they turned out to be of little practical use.
- Most of these packages are written in scripting languages like Python, which are slow and unsuitable for numerical programming. Even with libraries like NumPy and Cython added, the performance is no match to a program written in C from scratch like TuringBot.

In practice, what this means is that the formula you are looking for **may never be discovered** if you use a slow package unless it turns out to be relatively trivial.

TuringBot can be downloaded and used for free for as long as you want, but it also has a paid version that unlocks more functionalities. You can find more details on the Pricing page.

Make sure to check our YouTube channel, where many tutorials are available to help you quickly get started with the program.

Want to see TuringBot in action?

Check out the official blog.

In this example, we use symbolic regression to predict house prices as a function of their characteristics.

Here we use TuringBot to develop a classification algorithm that predicts stock market price changes.

Learn how to run TuringBot in a fully automated and customizable way from Python.

See also: Symbolic Regression: The Forgotten Machine Learning Method

(Towards Data Science).