FCNN4R (version 0.6.2)

mlp_net-export-import: Export and import multilayer perceptron network to/from a text file in FCNN format

Description

These functions can be used to export and import multilayer perceptron network to/from a text file in FCNN format.

Usage

mlp_export_fcnn(fname, net)
mlp_import_fcnn(fname)

Arguments

fname
character string with the filename
net
an object of mlp_net class

Value

mlp_export_fcnn returns logical value, TRUE if export was successful, FALSE otherwise.mlp_import_fcnn returns an object of mlp_net class or NULL, if import failed.

Details

Files are organised as follows:
  • the first comment (beginning with #) is treated as network information (name) string,
  • all other comments are ignored,
  • network structure is represented by five block of numbers:
    • the first line determines numbers of neurons in consecutive layers,
    • the second block of 0's and 1's determines which weights are turned off/on,
    • the third block contains active weights' values,
    • the last block determines hidden and output layers' activation functions and their slope parameters - each line contains 2 numbers: the function index and its slope parameter.

See Also

mlp_net for network representation details.

Examples

Run this code

# create a 2-3-1 network
net <- mlp_net(c(2, 3, 1))
# randomise weights
net <- mlp_rnd_weights(net)
# show the network
show(net)
# export network
mlp_export_fcnn("test.net", net)
# show the output file
file.show("test.net")
# import network
net2 <- mlp_import_fcnn("test.net")
# show the imported network
show(net2)

Run the code above in your browser using DataCamp Workspace