Previous Up Next

20.2.1  Creating neural networks

The command neural_network is used for creating trainable feed-forward neural networks.

Examples

To create a network with three layers of size 2, 3, and 1, input:

neural_network([2,3,1])
     
a neural network with input of size 2 and output of size 1           

To use GELU activation xx·Φ(x) for hidden neurons:

neural_network([2,3,1],func=unapply(x*normal_cdf(x),x))
     
a neural network with input of size 2 and output of size 1           

To define a penguin classifier:

net:=neural_network([10,15,7,3],classes=["adelie","chinstrap","gentoo"])
     
a classifier with input of size 10 and 3 classes           

Now we create a copy of net with block size changed to 10:

netcopy:=neural_network(net,block_size=10)
     
a classifier with input of size 10 and 3 classes           
netcopy[block_size]
     
10           

Previous Up Next