randomExpressionCreation: Creates an R expression by random growth

Description Usage Arguments Value

Description

Creates a random R expression by randomly growing its tree. In each step of growth, with probability subtreeprob, an operator is chosen from the function set funcset. The operands are then generated by recursive calls. If no subtree is generated, a constant will be generated with probability constprob. If no constant is generated, an input variable will be chosen randomly. The depth of the resulting expression trees can be bounded by the maxdepth parameter. randexprFull creates a random full expression tree of depth maxdepth. The algorithm is the same as randexprGrow, with the exception that the probability of generating a subtree is fixed to 1 until the desired tree depth maxdepth is reached.

Usage

1
2
3
4
randexprGrow(funcset, inset, conset, maxdepth = 8, constprob = 0.2,
  subtreeprob = 0.5, curdepth = 1)

randexprFull(funcset, inset, conset, maxdepth = 8, constprob = 0.2)

Arguments

funcset

The function set.

inset

The set of input variables.

conset

The set of constant factories.

maxdepth

The maximum expression tree depth.

constprob

The probability of generating a constant in a step of growth, if no subtree is generated. If neither a subtree nor a constant is generated, a randomly chosen input variable will be generated. Defaults to 0.2.

subtreeprob

The probability of generating a subtree in a step of growth.

curdepth

(internal) The depth of the random expression currently generated, used internally in recursive calls.

Value

A new R expression generated by random growth.


rgp documentation built on May 30, 2017, 12:45 a.m.