Main Content

Deploy Training of Shallow Neural Networks

Tip

To learn about code generation for deep learning, seeDeep Learning Code Generation.

UseMATLAB®俄文ntimeto deploy functions that can train a model. You can deploy MATLAB code that trains neural networks as described inCreate Standalone Application from MATLAB(MATLAB Compiler).

The following methods and functions are NOT supported in deployed mode:

Here is an example of how you can deploy training of a network. Create a script to train a neural network, for example,mynntraining.m:

% Create the predictor and response (target)x = [0.054 0.78 0.13 0.47 0.34 0.79 0.53 0.6 0.65 0.75 0.084 0.91 0.83 0.53 0.93 0.57 0.012 0.16 0.31 0.17 0.26 0.69 0.45 0.23 0.15 0.54]; t = [0.46 0.079 0.42 0.48 0.95 0.63 0.48 0.51 0.16 0.51 1 0.28 0.3];% Create and display the networknet = fitnet(); disp('Training fitnet')% Train the network using the data in x and tnet = train(net,x,t);% Predict the responses using the trained networky = net(x);% Measure the performanceperf = perform(net,y,t)

Compile the scriptmynntraining.mby using the command line:

mcc-m'mynntraining.m'

mccinvokes theMATLAB Compiler™to compile code at the prompt. The flag–mcompiles a MATLAB function and generates a standalone executable. The EXE file is now in your local computer in the working directory.

To run the compiled EXE application on computers that do not have MATLAB installed, you need to download and install MATLAB Runtime. Thereadme.txtcreated in your working folder has more information about the deployment requirements.

Related Topics