fit: fit

Description Usage Arguments Value Examples

Description

Function to train an Artificial Hydrocarbon Network (AHN).

Usage

1
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:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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)

jroberayalas/ahnr documentation built on May 20, 2019, 2:06 a.m.