Elm.predict: ELM Predictions

Description Usage Arguments Value References Examples

Description

Function for predictions from the results of ELM model fitting function.

Usage

1
Elm.predict(TrainedElm, X.fit)

Arguments

TrainedElm

an ELM object for which prediction is desired.

X.fit

Data matrix (numeric) containing the input values (predictors).

Value

The fitted values.

References

G.-B. Huang, Q.-Y. Zhu, C.-K. Siew (2006) Extreme learning machine: Theory and applications Neurocomputing 70 (2006) 489-501

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  set.seed(123)
  attach(wtloss)
  library("scales")
  
  train.index <- sample(length(wtloss$Days),size=40)
  
  #scaling the inputs/outputs
  x.train <- rescale(as.matrix(wtloss$Days), to=c(-1,1))[train.index]
  y.train <- rescale(as.matrix(wtloss$Weight), to=c(-1,1))[train.index]
  x.test <- rescale(as.matrix(wtloss$Days), to=c(-1,1))[-train.index]
  
  #training the ELM
  trained.elm <- Elm.train(x.train,y.train,Number.hn =5)
  
  #rescaling back the elm outputs
  elm.fit.values <- rescale(trained.elm$predictionTrain,
                            to= range(as.matrix(wtloss$Weight)),from=c(-1,1))
  elm.predicted.values <- rescale(Elm.predict(trained.elm, x.test),
                                to= range(as.matrix(wtloss$Weight)),from=c(-1,1))
  
  oldpar <- par(mar = c(5.1, 4.1, 4.1, 4.1))
  plot(wtloss$Days, wtloss$Weight, type = "p", ylab = "Weight (kg)",main="Weight Reduction",pch=20)
  points(wtloss$Days[train.index], elm.fit.values,col=2,type='p',pch=20)
  points(wtloss$Days[-train.index], elm.predicted.values,col=4,type='p',pch=20)

ForAI documentation built on May 2, 2019, 6:14 p.m.