mlp_net-combining-two-networks: Combining two networks into one

Description Usage Arguments Value Examples

Description

These functions construct new network by merging two networks (they must have the same number of layers) or by connecting one network outputs to another network inputs (the numbers of output and input neurons must agree). These functions may be used in constructing deep learning networks or constructing networks with some special topologies.

Usage

1
2
3
mlp_merge(net1, net2, same_inputs = FALSE)

mlp_stack(net1, net2)

Arguments

net1

an object of mlp_net class

net2

an object of mlp_net class

same_inputs

logical, if TRUE both merged networks are assumed to take the same inputs (they share the input layer), default is FALSE

Value

Both functions return an object of mlp_net class.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# create two 2-2-2 networks with random weights and plot them
net1 <- mlp_net(c(2, 2, 2))
net1 <- mlp_rnd_weights(net1)
mlp_plot(net1, TRUE)
net2 <- mlp_net(c(2, 2, 2))
net2 <- mlp_rnd_weights(net2)
mlp_plot(net2, TRUE)
# create a 4-3-2 network with random weights and plot it
net3 <- mlp_net(c(4, 3, 2))
net3 <- mlp_rnd_weights(net3)
mlp_plot(net3, TRUE)
# construct new network using net1, net2, and net3 and plot it
net4 <- mlp_stack(mlp_merge(net1, net2), net3)
mlp_plot(net4, TRUE)

FCNN4R documentation built on May 29, 2017, 4:26 p.m.