gep_train: Train a GEP model

View source: R/gepR.R

gep_trainR Documentation

Train a GEP model

Description

Fit a composite linear-nonlinear regression model using Gene Expression Programming. The gepR.dll must be present in the work directory and loaded using the gep_load_dll function.

Usage

gep_train(y, x, px1 = 0.4, px2 = 0.1, pm = 0.3, maxiter = 1000,
  headlen = 5, popsize = 100, eliterate = 0.1, goal = 0.95,
  rseed = 8888, nthreads = 4, verbose = 1, fit_method = 0,
  maxpass = 3, sol_file = "gep_sol.dat")

Arguments

y

numeric vector containing the response variable

x

numeric dataframe containing the independent variables

px1

one-point crossover rate, between 0 and 1

px2

two-point crossover rate, between 0 and 1

pm

mutation rate, between 0 and 1

maxiter

maximum number of iteration (generations) per round

headlen

head length of a gene

popsize

population size (number of individuals per generation), default 100. This is where the OpenMP "parallel for" takes effect. So it is preferred to be an integer multiple of nthreads.

eliterate

elite rate, the proportion in the population to survive to the next generation, between 0 and 1

goal

the targeted R-square value, between 0 and 1, default 0.95. The program stops when R-square achieves this value.

rseed

random seed to be used in the C program, integer value

nthreads

number of parallel threads to be used in computation, ideally set to equal to the number of cores available

verbose

verbose leve, 0 to 2, 0 terse, 2 verbose

fit_method

0: regression, 1: classification, default 0. Only 0 is implemented in this version.

sol_file

character string of the path and name of the file where the GEP model is to be saved.

Value

sol_file

Examples

gep_load_dll()
gepmod <- gep_train(elecdemand[,1], elecdemand[,2:4], nthreads=20)
predval <- gep_score(elecdemand[,2:4], gepmod)
gep_unload_dll()


profyliu/gepR documentation built on Sept. 3, 2023, 8:52 p.m.