randomExpressionCreationTyped: Creates an R expression by random growth respecting type...

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 function of matching range type exists, a terminal (constant or input variable) will be generated instead. 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. In contrast to randexprGrow, this function respects sTypes of functions, input variables, and constant factories. Only well-typed expressions are created. randexprTypedFull creates a random full expression tree of depth maxdepth, respecting type constraints.

Usage

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

randexprTypedFull(type, funcset, inset, conset, maxdepth = 8,
  constprob = 0.2)

Arguments

type

The (range) type the created expression should have.

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.