Learn R Programming

IBHM (version 1.1-11)

predict.IBHM: predict.IBHM

Description

Predicted values based on IBHM model object.

Usage

"predict"(object, x, ...)

Arguments

object
Object of class inheriting from "ibhm"
x
An object for which the predictions will be calculated - should be convertible to a matrix. If not given the values from the training data are used.
...
Further arguments.

Value

predict.IBHM returns a vector of predicted values with length corresponding to the number of rows of the x parameter.

See Also

TrainIBHM

Examples

Run this code
  x.train <-seq(-2,2,length.out=100)
  y.train <-tanh(x.train)
  
  m <- IBHM::TrainIBHM(x.train,y.train)  
  cat('Train MSE:',mean((y.train-predict(m))^2),'\n')
  
  x.test <- runif(100, min=-4, max=4)
  yh.test <- predict(m, x.test)
    
  plot(x.test, yh.test)

Run the code above in your browser using DataLab