Description Usage Arguments Details Note See Also Examples
Operators to extract or replace layers of a DeepBeliefNet
object, and to extract weights and biases of a RestrictedBolzmannMachine
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## S3 method for class 'DeepBeliefNet'
x[[i]]
## S3 replacement method for class 'DeepBeliefNet'
x[[i]] <- value
## S3 method for class 'DeepBeliefNet'
x[i, drop = FALSE]
## S3 method for class 'RestrictedBolzmannMachine'
x$name
## S3 replacement method for class 'RestrictedBolzmannMachine'
x$name <- value
|
x |
the DBN (for |
i |
indices specifying the layer to extract or replace |
value |
the RestrictedBolzmannMachine to insert. |
drop |
whether to drop the DeepBeliefNet if it contains a single RestrictedBolzmannMachine. |
name |
either |
[[
extracts (and [[<-
replaces) exactly one RestrictedBolzmannMachine
layer of the DeepBeliefNet.
[
extracts one or more layers of the DeepBeliefNet. If the returned DeepBeliefNet. has exactly one RestrictedBolzmannMachine, the drop
argument controls whether the function returns an RestrictedBolzmannMachine
object (TRUE
)
or a DeepBeliefNet
object containing one single RestrictedBolzmannMachine
(FALSE
).
When extracting layers, the pretrained
and finetuned
switches will match those of the DeepBeliefNet that was supplied, while unrolled
will be set to FALSE
.
When replacement layers, the pretrained
switch will be on if all the RestrictedBolzmannMachines
are pretrained, while finetuned
and unrolled
will be set to FALSE
.
For the time being, weights and biases of a RestrictedBolzmannMachine
cannot be replaced.
If the DeepBeliefNet contains N layers, there are N-1 RestrictedBolzmannMachines.
DeepBeliefNet
, RestrictedBolzmannMachine
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | dbn <- DeepBeliefNet(Layers(c(784, 1000, 500, 250, 30), input="continuous", output="gaussian"))
# Extract a RBM
dbn[[2]]
# Replace a RBM
dbn[[1]] <- RestrictedBolzmannMachine(Layer(10, "binary"), Layer(1000, "binary"))
dbn[[2]] <- RestrictedBolzmannMachine(Layer(1000, "binary"), Layer(500, "binary"))
dbn[[4]] <- RestrictedBolzmannMachine(Layer(250, "binary"), Layer(2, "gaussian"))
## Not run:
# Cannot replace incompatible RestrictedBolzmannMachines
dbn[[2]] <- RestrictedBolzmannMachine(1000, 400, input="binary", output="binary")
dbn[[2]] <- RestrictedBolzmannMachine(100, 500, input="binary", output="binary")
dbn[[2]] <- RestrictedBolzmannMachine(1000, 500, input="binary", output="continuous")
dbn[[2]] <- RestrictedBolzmannMachine(1000, 500, input="gaussian", output="binary")
## End(Not run)
# Get the first layer as RestrictedBolzmannMachine
dbn[[1]]
dbn[1, drop=TRUE]
# Get the first layer as DeepBeliefNet
rbm <- dbn[1]
# Get the first layer as RestrictedBolzmannMachine
rbm$W
rbm$b
rbm$c
rbm$b <- 1:10
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.