Main Content

Custom Neural Network Helper Functions

The toolbox allows you to create and use your own custom functions. This gives you a great deal of control over the algorithms used to initialize, simulate, and train your networks.

Be aware, however, that custom functions may need updating to remain compatible with future versions of the software. Backward compatibility of custom functions cannot be guaranteed.

Template functions are available for you to copy, rename and customize, to create your own versions of these kinds of functions. You can see the list of all template functions by typing the following:

help nncustom

Each template is a simple version of a different type of function that you can use with your own custom networks.

For instance, make a copy of the filetansig.mwith the new namemytransfer.m. Start editing the new file by changing the function name a the top fromtansigtomytransfer.

You can now edit each of the sections of code that make up a transfer function, using the help comments in each of those sections to guide you.

Once you are done, store the new function in your working folder, and assign the name of your transfer function to thetransferFcnproperty of any layer of any network object to put it to use.