Target Expression Examples

The "Target Expression" in the field at the top of the Set Target tab tells Eureqa what type of model to search for. By default, the target expression is an equation where y (or, if there's no y, whatever variable is in column A) is modeled as a function of all other variables. To edit the target expression, click on it, then make the desired alterations. Use the special function f(…) to specify the part of the equation that Eureqa will attempt to fill in; Eureqa will search for the formula f(…) using the variables you put inside the parentheses.

The following examples assume that the data entered into the Eureqa spreadsheet has four variables named w, x, y, and z. See the Enter Data page for more information.

Basic examples

Model the variable y as a function of variable x:

y = f(x)

Model the variable z as a function of two variables, x and y:

z = f(x, w)

Model the variable z as a function of y and an expression, sin(x):

z = f( y, sin(x) )

Model arbitrary expressions with target expressions like the following:

sin(z + 3) = 100*w + x*f( y, y/(x+1) )

Multiple functions

To incorporate multiple functions into your target expression, use numbered functions starting with f0(). For example:

y = f0(x) + f1(w, z)

Fitting coefficients

You can represent an unknown constant or coefficient as a function with no arguments, f(). And you can use multiple no-argument functions—f0(), f1(), etc.—to fit the coefficients of arbitrary nonlinear equations. For example, if you're looking for a polynomial equation of the form

y = a*x + b*x^2 + c*x^3

use the following target expression:
y = f0()*x + f1()*x^2 + f2()*x^3

Binary classification

If y is a binary variable filled with 0s and 1s, model it using a squashing function, such as the logistic function:

y = logistic( f(x) )

If the output variable has three or more class values, re-enter the data as a binary variable for each class value. For example, if y can have values a, b, or c, you might transfer the data into binary variables y_a, y_b, and y_c:

x y y_a y_b y_c
1 a 1 0 0
2 c 0 0 1
3 b 0 1 0
4 c 0 0 1

You can then model each of these binary variables individually in three different searches using the following target expressions:

y_a = logistic( f(x) )
y_b = logistic( f(x) )
y_c = logistic( f(x) )

You then have three equations, one for each output, each output being analogous to the one output of an artificial neural network.

Differential equations

Model the derivative of y with respect to the spreadsheet row number as a function of x and y:

D(y) = f(x, y)

Model the derivative of y with respect to x as a function of x and y:

D(y, x) = f(x, y)

Model the second derivative of y with respect to x as a function of x, y, and the first derivative of y:

D(y, x, 2) = f( x, y, D(y,x) )

Custom error metrics

You can design your target expression so that it functions
close the window as a custom error metric. For example, to minimize the 4th-power error:

(y - f(x))^4 = 0

More details can be found on this blog post: Custom error metrics and special Search Relations

Nested functions

Model the output of a recursive or iterated function to a depth of 3:

y = f(f(f( x )))

Tips and tricks

Entering an ellipsis, "", will automatically fill in all your variable names separated by commas. For example:

y = f(...)

after pressing enter, will become:
y = f(w, x, y, z)