简体   繁体   中英

How to get the function result from Symbolic Regression with R

First, please excuse my ignorance because I've just started learning R today.

I have a data frame of two variables (x, y) as follows: (1,0), (2,26), (3,88), (4,186), (5,320), (6,490), (7,541) . I want to use Symbolic Regression to find a function f such that y = f(x) .

Following the tutorial here , I can have a plot of f(x) , which is closed to what I expect. However, I don't know how to print out the function f(x) .

I tried with another tool called Eurequa. It is pretty easy to use, and gives me (a lot of) functions. But I can't use a commercial tool for my project. Thank you.


UPDATE

Here is my code to compute Symbolic Regression and plot the function. I enter the command one by one in R environment.

x = c (1, 2, 3, 4, 5, 6, 7)
y = c (0, 26, 88, 186, 320, 490, 541)
data1 = data.frame(x,y)
newFuncSet <- functionSet("+","-","*")
result1 <- symbolicRegression(y ~ x, data = data1, functionSet = newFuncSet, stopCondition = makeStepsStopCondition(2000))
plot(data1$y, col=1, type="l"); points(predict(result1, newdata = data1), col=2, type="l")

model <- result1$population[[which.min(result1$fitnessValues)]]

可以在此处找到包含许多示例的rgp包的介绍

I have tried quite a few symbolic regression implementations, including rgp, gplearn and a Python tool called fast-symbolic-regression. None of these was nearly comparable to Eureqa, a symbolic regression tool that I first used in 2015 and that left the market in 2017.

Recently a new symbolic regression tool called TuringBot was developed, and it was shown in arXiv:2010.11328 to be more efficient than Eureqa at finding formulas. So I would recommend TuringBot for symbolic regression in 2020.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM