Autoencoder.generateFunction - Generate a MATLAB function to run the autoencoder - MATLAB (original) (raw)
Class: Autoencoder
Generate a MATLAB function to run the autoencoder
Syntax
Description
generateFunction([autoenc](#buxdn3y%5Fsep%5Fshared-autoenc))
generates a complete stand-alone function in the current directory, to run the autoencoder autoenc
on input data.
generateFunction([autoenc](#buxdn3y%5Fsep%5Fshared-autoenc),[pathname](#buxdn3y-pathname))
generates a complete stand-alone function to run the autoencoder autoenc
on input data in the location specified by pathname
.
generateFunction([autoenc](#buxdn3y%5Fsep%5Fshared-autoenc),[pathname](#buxdn3y-pathname),[Name,Value](#namevaluepairarguments))
generates a complete stand-alone function with additional options specified by the Name,Value
pair argument.
Input Arguments
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 Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, where Name
is the argument name and Value
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose Name
in quotes.
Indicator to display the links to the generated code in the command window, specified as the comma-separated pair consisting of 'ShowLinks'
and either true
or false
.
Example: 'ShowLinks',true
Data Types: logical
Examples
Load the sample data.
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 nameneural_function.m
. You can change the file name aftergenerateFunction
generates it. Or you can specify the path and file name using the pathname input argument in the call togenerateFunction
.
Version History
Introduced in R2015b