Last data update: 2014.03.03

R: predict.IBHM
predict.IBHMR Documentation

predict.IBHM

Description

Predicted values based on IBHM model object.

Usage

## S3 method for class 'IBHM'
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

  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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(IBHM)
Loading required package: compiler
Loading required package: DEoptim

DEoptim package
Differential Evolution algorithm in R
Authors: D. Ardia, K. Mullen, B. Peterson and J. Ulrich

Loading required package: cmaes
Loading required package: Rcpp
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/IBHM/predict.IBHM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: predict.IBHM
> ### Title: predict.IBHM
> ### Aliases: predict.IBHM predict
> ### Keywords: ~models ~regression ~nonlinear
> 
> ### ** Examples
> 
>   x.train <-seq(-2,2,length.out=100)
>   y.train <-tanh(x.train)
>   
>   m <- IBHM::TrainIBHM(x.train,y.train)  
Note: no visible binding for global variable '.refClassDef' 
Note: no visible binding for global variable '.refClassDef' 
Note: no visible binding for global variable '.pointer' 
Note: no visible binding for global variable '.pointer' 
Note: no visible binding for global variable '.pointer' 
>   cat('Train MSE:',mean((y.train-predict(m))^2),'\n')
Train MSE: 9.882613e-12 
>   
>   x.test <- runif(100, min=-4, max=4)
>   yh.test <- predict(m, x.test)
>     
>   plot(x.test, yh.test)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
> 
Note: no visible binding for global variable '.pointer'