R/predict_Weights.R

predict.Weights <- function(object, newdata, delete.firstColumn=TRUE, ...){
  
  weights <- object
  data <- newdata
  
  # count variables
  numberOfVar <- ncol(data)
  
  start <- 1
  
  # if first column is there
  if(delete.firstColumn){start <- 2}
  
  # calculate prediction
  if(is(weights,"Weights")) {
    pred <- apply(data, 1, function(x) computeOutput1(x[start:numberOfVar],weights))
  } else {
    pred <- apply(data, 1, function(x) computeOutput2(x[start:numberOfVar],weights))
  }
  
  pred
  
}# end of function

Try the TeachNet package in your browser

Any scripts or data that you put into this service are public.

TeachNet documentation built on May 2, 2019, 7 a.m.