error: Compute Reconstruction Error

Description Usage Arguments Value Examples

View source: R/error.R

Description

Computes the reconstruction error (rmse) of the prediction of the data. rmse is an alias for error. errorSum sum the error over the data points.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
error(...)

rmse(...)

errorSum(...)

## S3 method for class 'DeepBeliefNet'
error(x, data, ...)

## S3 method for class 'DeepBeliefNet'
rmse(x, data, ...)

## S3 method for class 'DeepBeliefNet'
errorSum(x, data, ...)

## S3 method for class 'RestrictedBolzmannMachine'
error(x, data, ...)

## S3 method for class 'RestrictedBolzmannMachine'
rmse(x, data, ...)

## S3 method for class 'RestrictedBolzmannMachine'
errorSum(x, data, ...)

Arguments

...

further arguments to the plot function above and to the predict function.

x

the RestrictedBolzmannMachine or DeepBeliefNet object

data

feature vector

Value

the reconstruction error of the data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(mnist)
data(mnist)
data(trained.mnist)

# Calculate (reconstruction) error per data point
err <- error(trained.mnist, mnist$test$x)
length(err) # 1 value per data point
# error and rmse are synonymous
identical(err, rmse(trained.mnist, mnist$test$x))

# errorSum returns the sum
sum <- errorSum(trained.mnist, mnist$test$x)
print(sum)
all.equal(sum, sum(err)) 
# There may be some rounding errors though, so this might not be ==:
sum == sum(err)

# On a RestrictedBolzmannMachine
data(pretrained.mnist)
rbm <- pretrained.mnist[[1]]
errorSum(rbm, mnist$test$x)
err <- error(rbm, mnist$test$x)
identical(err, rmse(rbm, mnist$test$x))

xrobin/DeepLearning documentation built on May 17, 2018, 3:51 a.m.