fit {ahnr}R Documentation

fit

Description

Function to train an Artificial Hydrocarbon Network (AHN).

Usage

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

# 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)


[Package ahnr version 0.3.1 Index]