generateFunction

Class: Autoencoder

Generate a MATLAB function to run the autoencoder

Description

example

generateFunction(autoenc) generates a complete stand-alone function in the current directory, to run the autoencoder autoenc on input data.

example

generateFunction(autoenc,pathname) generates a complete stand-alone function to run the autoencoder autoenc on input data in the location specified by pathname.

generateFunction(autoenc,pathname,Name,Value) generates a complete stand-alone function with additional options specified by the Name,Value pair argument.

Input Arguments

expand all

Trained autoencoder, returned as an object of the Autoencoder class.

Location for generated function, specified as a string.

Example: 'C:\MyDocuments\Autoencoders'

Data Types: char

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Examples

expand all

Load the sample data.

X = iris_dataset;

Train an autoencoder with 4 neurons in the hidden layer.

autoenc = trainAutoencoder(X,4);

Generate the code for running the autoencoder. Show the links to the MATLAB® function.

generateFunction(autoenc)
MATLAB function generated: neural_function.m
To view generated function code: edit neural_function
For examples of using function: help neural_function

Generate the code for the autoencoder in a specific path.

generateFunction(autoenc,'H:\Documents\Autoencoder')
MATLAB function generated: H:\Documents\Autoencoder.m
To view generated function code: edit Autoencoder
For examples of using function: help Autoencoder

Tips

  • If you do not specify the path and the file name, generateFunction, by default, creates the code in an m-file with the name neural_function.m. You can change the file name after generateFunction generates it. Or you can specify the path and file name using the pathname input argument in the call to generateFunction.

Introduced in R2015b