Single Layer Feedforward Network

Description

Constructs a SLFN, an artificial neural network with a single input and output layer, and no hidden layer.

Usage

1
2
3
SLFN(formula,parameters=list(eta=.01,alpha=0,beta=0,ws=0),
type=c("linear","logistic"),data,subset,fixed,parStruct,window.size=0,
remove.intercept=FALSE,base=NULL,ntimes=NULL,replicate=T)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. For more details of model specification, see lm or glm.

parameters

a named list with (starting) values for the parameters. See details.

type

the name of the activation function. Currently, only linear and logistic activation functions are implemented. See Example on how to use other activation functions.

data

(optional) data frame.

subset

(optional) subset.

fixed

(optional) logical vector indicating whether parameters are fixed (TRUE) or freely estimable (FALSE).

parStruct

(optional) ParStruct object. Note that if parStruct is given, the ‘fixed’ argument above will be ignored.

window.size

an integer >= 0 specifying the number of previous data points used to compute the gradient (in addition to the current data point).

remove.intercept

should an intercept be included in the predictors? If set to TRUE, an intercept term (if present) will be removed from x. This can be useful when the predictors are categorical variables, where removing the intercept in the formula will result in an extra dummy variable.

base

if the criterion (rhs of formula) is a factor, an overparametrized dummy coding will be used by default. That is, for a criterion with n levels, a dummy matrix will be used with n columns. By setting base to an integer k, 1 <= k <= n, column k will be removed from the matrix.

ntimes

an optional vector with, for each repetition in the data, the total number of trials.

replicate

are the repeated series true replications, i.e., are the model parameters considered identical for each series?

Details

The SLFN function sets up a simple ANN useful for deriving online model predictions etc.

Value

A (fitted) object of class SLFN extending LearningModel

References

Bishop, C.M. (1995). Neural Networks for Pattern Recognition. Oxford, UK: Oxford University Press.

Gluck, M. A., & Bower, G. H. (1988). From conditioning to category learning: An adaptive network model. Journal of Experimental Psychology: General, 117, 227–247.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## open weather prediction data
data(WPT)
## initialize model
mod <- SLFN(y~x1+x2+x3+x4,type="logistic",data=WPT,ntimes=rep(200,25),parameters=list(eta=.1,alpha=.001),fix=list(beta=TRUE,ws=TRUE),remove.intercept=TRUE)
## estimate free parameters
## Not run: mod <- fit(mod)
summary(mod)

## TODO: add other activation function

##