Description Usage Arguments Details Value Examples
The GP search space is defined by a set of functions, a set of input variables, a set of constant constructor functions, and some rules how these functions, input variables, and constants may be combined to form valid symbolic expressions. The function set is simply given as a set of strings naming functions in the global environment. Input variables are also given as strings. Combination rules are implemented by a type system and defined by assigning sTypes to functions, input variables, and constant constructors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | functionSet(..., list = NULL, parentEnvironmentLevel = 1)
inputVariableSet(..., list = NULL)
constantFactorySet(..., list = NULL)
pw(x, pw)
hasPw(x)
getPw(x, default = 1)
## S3 method for class 'functionSet'
c(..., recursive = FALSE)
## S3 method for class 'inputVariableSet'
c(..., recursive = FALSE)
## S3 method for class 'constantFactorySet'
c(..., recursive = FALSE)
|
... |
Names of functions or input variables given as strings. |
list |
Names of functions or input variables given as a list of strings. |
parentEnvironmentLevel |
Level of the parent environment used to resolve function names. |
recursive |
Ignored when concatenating function- or input variable sets. |
x |
An object (function name, input variable name, or constant
factory) to tag with a probability |
pw |
A probability weight. |
default |
A default probability weight to return iff no probability weight is associated with an object. |
Function sets and input variable sets are S3 classes containing
the following fields: \$all
contains a list of all
functions, or input variables, or constant factories.
\$byRange
contains a table of all input variables, or
functions, or constant factories, indexed by the string label of
their sTypes for input variables, or by the string label of their
range sTypes for functions, or by the string label of their range
sTypes for constant factories. This field exists mainly for
quickly finding a function, input variable, or constant factory
that matches a given type.
Multiple function sets, or multiple input variable sets, or
multiple constant factory sets can be combined using the
c
function. functionSet
creates a function
set. inputVariableSet
creates an input variable set.
constantFactorySet
creates a constant factory set.
Probability weight for functions, input variables, and constants
can be given by tagging constant names, input variables, and
constant factory functions via the pw
function (see
the examples). The predicate hasPw
can be used to check
if an object x
has an associated probability weight.
The function getPw
returns the probability weight
associated with an object x
, if available.
A function set or input variable set.
1 2 3 4 5 6 | # creating an untyped search space description...
functionSet("+", "-", "*", "/", "exp", "log", "sin", "cos", "tan")
inputVariableSet("x", "y")
constantFactorySet(function() runif(1, -1, 1))
# creating an untyped function set with probability weights...
functionSet(pw("+", 1.2), pw("-", 0.8), pw("*", 1.0), pw("/", 1.0))
|
sh: 1: cannot create /dev/null: Permission denied
*** RGP version 0.4-1 initialized successfully.
Type 'help(package="rgp")' to bring up the RGP help pages,
or type 'vignette("rgp_introduction")' to show RGP's package vignette.
Type 'symbolicRegressionUi()' to bring up the symbolic regression UI if
the optional package 'rgpui' is installed.
$all
$all[[1]]
[1] "+"
$all[[2]]
[1] "-"
$all[[3]]
[1] "*"
$all[[4]]
[1] "/"
$all[[5]]
[1] "exp"
$all[[6]]
[1] "log"
$all[[7]]
[1] "sin"
$all[[8]]
[1] "cos"
$all[[9]]
[1] "tan"
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
attr(,"probabilityWeight")[[5]]
[1] 1
attr(,"probabilityWeight")[[6]]
[1] 1
attr(,"probabilityWeight")[[7]]
[1] 1
attr(,"probabilityWeight")[[8]]
[1] 1
attr(,"probabilityWeight")[[9]]
[1] 1
$byType
$byType$`(numeric, numeric) -> numeric`
$byType$`(numeric, numeric) -> numeric`[[1]]
`+`
$byType$`(numeric, numeric) -> numeric`[[2]]
`-`
$byType$`(numeric, numeric) -> numeric`[[3]]
`*`
$byType$`(numeric, numeric) -> numeric`[[4]]
`/`
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
$byType$`(numeric) -> numeric`
$byType$`(numeric) -> numeric`[[1]]
exp
$byType$`(numeric) -> numeric`[[2]]
log
$byType$`(numeric) -> numeric`[[3]]
sin
$byType$`(numeric) -> numeric`[[4]]
cos
$byType$`(numeric) -> numeric`[[5]]
tan
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
attr(,"probabilityWeight")[[5]]
[1] 1
$byRange
$byRange$numeric
$byRange$numeric[[1]]
`+`
$byRange$numeric[[2]]
`-`
$byRange$numeric[[3]]
`*`
$byRange$numeric[[4]]
`/`
$byRange$numeric[[5]]
exp
$byRange$numeric[[6]]
log
$byRange$numeric[[7]]
sin
$byRange$numeric[[8]]
cos
$byRange$numeric[[9]]
tan
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
attr(,"probabilityWeight")[[5]]
[1] 1
attr(,"probabilityWeight")[[6]]
[1] 1
attr(,"probabilityWeight")[[7]]
[1] 1
attr(,"probabilityWeight")[[8]]
[1] 1
attr(,"probabilityWeight")[[9]]
[1] 1
$nameStrings
[1] "+" "-" "*" "/" "exp" "log" "sin" "cos" "tan"
$arities
[1] 2 2 2 2 1 2 1 1 1
$envir
<environment: R_GlobalEnv>
attr(,"class")
[1] "functionSet" "list"
$all
$all[[1]]
[1] "x"
$all[[2]]
[1] "y"
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
$allFormals
$allFormals[[1]]
x
$allFormals[[2]]
y
$byType
list()
$byRange
list()
$nameStrings
[1] "x" "y"
attr(,"class")
[1] "inputVariableSet" "list"
$all
$all[[1]]
function ()
runif(1, -1, 1)
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
$byType
$byType$`function`
$byType$`function`[[1]]
function ()
runif(1, -1, 1)
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
$byRange
$byRange$`function`
$byRange$`function`[[1]]
function ()
runif(1, -1, 1)
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"class")
[1] "constantFactorySet" "list"
$all
$all[[1]]
[1] "+"
attr(,"probabilityWeight")
[1] 1.2
$all[[2]]
[1] "-"
attr(,"probabilityWeight")
[1] 0.8
$all[[3]]
[1] "*"
attr(,"probabilityWeight")
[1] 1
$all[[4]]
[1] "/"
attr(,"probabilityWeight")
[1] 1
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1.2
attr(,"probabilityWeight")[[2]]
[1] 0.8
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
$byType
$byType$`(numeric, numeric) -> numeric`
$byType$`(numeric, numeric) -> numeric`[[1]]
`+`
$byType$`(numeric, numeric) -> numeric`[[2]]
`-`
$byType$`(numeric, numeric) -> numeric`[[3]]
`*`
$byType$`(numeric, numeric) -> numeric`[[4]]
`/`
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
$byRange
$byRange$numeric
$byRange$numeric[[1]]
`+`
$byRange$numeric[[2]]
`-`
$byRange$numeric[[3]]
`*`
$byRange$numeric[[4]]
`/`
attr(,"probabilityWeight")
attr(,"probabilityWeight")[[1]]
[1] 1
attr(,"probabilityWeight")[[2]]
[1] 1
attr(,"probabilityWeight")[[3]]
[1] 1
attr(,"probabilityWeight")[[4]]
[1] 1
$nameStrings
[1] "+" "-" "*" "/"
$arities
[1] 2 2 2 2
$envir
<environment: R_GlobalEnv>
attr(,"class")
[1] "functionSet" "list"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.