Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

reconstruction_error-dimRedResult-method

Method reconstruction_error


Description

Calculate the error using only the first n dimensions of the embedded data. error_fun can either be one of c("rmse", "mae") to calculate the root mean square error or the mean absolute error respectively, or a function that takes to equally sized vectors as input and returns a single number as output.

Usage

## S4 method for signature 'dimRedResult'
reconstruction_error(object,
  n = seq_len(ndims(object)), error_fun = "rmse")

Arguments

object

of class dimRedResult

n

a positive integer or vector of integers <= ndims(object)

error_fun

a function or string indicating an error function, if indication a function it must take to matrices of the same size and return a scalar.

Value

a vector of number with the same length as n with the

Author(s)

Guido Kraemer

See Also

Examples

## Not run: 
ir <- loadDataSet("Iris")
ir.drr <- embed(ir, "DRR", ndim = ndims(ir))
ir.pca <- embed(ir, "PCA", ndim = ndims(ir))

rmse <- data.frame(
  rmse_drr = reconstruction_error(ir.drr),
  rmse_pca = reconstruction_error(ir.pca)
)

matplot(rmse, type = "l")
plot(ir)
plot(ir.drr)
plot(ir.pca)

## End(Not run)

dimRed

A Framework for Dimensionality Reduction

v0.2.3
GPL-3 | file LICENSE
Authors
Guido Kraemer [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.