calcError: Calculate the prediction error

View source: R/MTL.R

calcErrorR Documentation

Calculate the prediction error

Description

Calculate the averaged prediction error across tasks. For classification problem, the miss-classification rate is returned, and for regression problem, the mean square error(MSE) is returned.

Usage

calcError(m, newX = NULL, newY = NULL)

Arguments

m

A MTL model

newX

The feature matrices of new individuals

newY

The responses of new individuals

Value

The averaged prediction error

Examples

#create example data
data<-Create_simulated_data(Regularization="L21", type="Regression")
#train a model 
model<-MTL(data$X, data$Y, type="Regression", Regularization="L21",
    Lam1=0.1, Lam2=0, opts=list(init=0,  tol=10^-6, maxIter=1500)) 
#calculate the training error
calcError(model, newX=data$X, newY=data$Y)
#calculate the test error
calcError(model, newX=data$tX, newY=data$tY)


RMTL documentation built on May 2, 2022, 5:06 p.m.