R User Manual (low usability)

November 11, 2009
by Jeremy Koelmel (jpk07)

I wrote a few more pieces of code in R and worked to allow a R user to use PushGP to evolve a push formula for their data and return dependent variable results upon input of any independent variable. Once they download the package they will only have to work through the R console. So far the manual probably has too many steps (although some are necessary if they want to control the parameters), and hence the usability should be further streamlined. Ultimately there should only be 3 steps: 1) insert data, 2) call a function on your data (and change parameters if wanted) that does all the steps necessary to return a PushGP function and the correlation coefficient (or related fitness value), and 3) input any independent variables to see the resulting dependent variable.

Here is how the R manual looks (although it may be totally different as Dan is working on something that may change how the whole R PushGP information transfer works):

Instructions for Users:

1) Load your data into R under these two variables:

2) Create the file to format your data and parameters:
a) navigate to the directory which holds user files:
> setwd(“~/Desktop/AI/R/PackageFiles/UserFiles”);

b) source setParameters.R
> source(“setParameters.R”);
Configuration file will automatically be saved in the UserFiles folder as MyData.txt


here are the user options (defining them is optional):
> MyParameters <- SetParameters(Population Size, Execution Limit, Tournament Size, Mutation Rate, Crossover Percentage, Maximum Generations, Maximum Code Size, Mutation Range, Push Function Set)
here is an example of setting the parameters (the predefined parameters):
> MyParameters <- SetParameters(2000, 80, 7, 20, 70, 200, 40, .3, “FLOAT.* FLOAT.+ FLOAT.% FLOAT.DUP FLOAT.- FLOAT.SWAP FLOAT.ERC”);

Now you must export the new parameters as a configuration file:
> write(MyParameters, file = “~/Desktop/AI/R/PackageFiles/UserFiles/MyData.txt”)

Your data and parameters will be routed to PshGP (done) and your Push Function will be returned. *needs to be done* (it should be returned in the format shown in the file Function.R).

3) Now you can see the function and get Y Values for any given X Value:
> source(“RunningPushFunction.R”);
a) put in the x-value you want the y-value for, ie:
> x <- 42
b) run the function on it:
> source(“InterpretFunction.R”);
c) Display the answers (the last number in the list returned is your answer)
> Floats

Leave a Reply

You must be logged in to post a comment.