FCNN4R (version 0.6.2)

mlp_net-manipulating-network-inputs: Manipulating network inputs

Description

These functions construct new network by removing redundant (i.e. not connected to the next layer) inputs or reordering / expanding network inputs.

Usage

mlp_rm_input_neurons(net, report = FALSE)
mlp_expand_reorder_inputs(net, newnoinputs, inputsmap)

Arguments

net
an object of mlp_net class
report
logical value, if TRUE, information about removed neurons will be printed on the console (FALSE by default)
newnoinputs
integer value, determines the number of inputs in the new network
inputsmap
integer vector, determines the mapping of old inputs into new ones - the ith value of this vector will be the new index of ith input

Value

mlp_rm_input_neurons returns a two-element list. The first element (net) is the network (an object of mlp_net class) with all redundant input neurons removed, the second (ind) - the indices of input neurons that were not removed.mlp_expand_reorder_inputs returns an object of mlp_net class.

Examples

Run this code

# construct a 2-4-3 network, plot result
nn <- mlp_net(c(2, 4, 3))
nn <- mlp_rnd_weights(nn)
mlp_plot(nn, TRUE)
# expand inputs, the new no. of inputs will be 5, with the first input
# becoming the 3rd and the second retaining its position, plot result
nn <- mlp_expand_reorder_inputs(nn, 5, c(3, 2))
mlp_plot(nn, TRUE)
# remove redundant neurons (i.e. 1, 4, 5) and plot result
nn <- mlp_rm_input_neurons(nn, TRUE)$net
mlp_plot(nn, TRUE)

Run the code above in your browser using DataLab