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.
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.
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
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)
}