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.

example

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.

example

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

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 Arguments

expand all

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

expand all

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

Version History

Introduced in R2015b