Learn R Programming

dimRed (version 0.2.5)

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 dimRedResult
reconstruction_error(object, n = seq_len(ndims(object)), error_fun = "rmse")

Value

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

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.

Author

Guido Kraemer

See Also

Other Quality scores for dimensionality reduction: AUC_lnK_R_NX,dimRedResult-method, LCMC,dimRedResult-method, Q_NX,dimRedResult-method, Q_global,dimRedResult-method, Q_local,dimRedResult-method, R_NX,dimRedResult-method, cophenetic_correlation,dimRedResult-method, distance_correlation,dimRedResult-method, mean_R_NX,dimRedResult-method, plot_R_NX(), quality,dimRedResult-method, reconstruction_rmse,dimRedResult-method, total_correlation,dimRedResult-method

Examples

Run this code
if (FALSE) {
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)
}

Run the code above in your browser using DataLab