Function to train an Artificial Hydrocarbon Network (AHN).

fit(Sigma, n, eta, maxIter = 2000)

Arguments

Sigma

a list with two data frames. One for the inputs X, and one for the outputs Y.

n

number of particles to use.

eta

learning rate of the algorithm. Default is 0.01.

maxIter

maximum number of iterations.

Value

an object of class "ahn" with the following components:

  • network: structure of the AHN trained.

  • Yo: original output variable.

  • Ym: predicted output variable.

  • eta: learning rate.

  • minOverallError: minimum error achieved.

  • variableNames: names of the input variables.

Examples

# Create data x <- 2 * runif(1000) - 1; x <- sort(x) y <- (x < 0.1) * (0.05 * runif(100) + atan(pi*x)) + (x >= 0.1 & x < 0.6) * (0.05 * runif(1000) + sin(pi*x)) + (x >= 0.6) * (0.05 * runif(1000) + cos(pi*x)) # Create Sigma list Sigma <- list(X = data.frame(x = x), Y = data.frame(y = y)) # Train AHN ahn <- fit(Sigma, 5, 0.01, 500)