## Sine wave regression using Bayesian regularization

SINE WAVE APPROXIMATION

This example illustrates using a Bayesian neural network to approximate the sine function to demonstrate the generalization property of the Bayesian Neural Network that can avoid over-fitting issue in classification and regression applications.

The Sine data-set can be found in Examples-> Fitting Example folder under ANNHUB installation folder.

This data-set contains training data-set (SineTraining.csv) used to train a neural network and test data-set (SimpleTest.csv) to test/evaluate the obtained trained neural network. The data structure contains 1 input feature (time) and 1 output class (sine wave value at input time) = sin(2*pi*time).

1. Design a neural network using ANNHUB

The step by step tutorial to design a neural network in ANNHUB can be found in Bayesian Neural Network application.

2. Export a trained neural network model to weight file.

When the trained neural network has been evaluated and tested with new test data-set, it can be exported into a weight file (.ann extension) using Export function in ANNHUB. Please refer to IRIS example to see how to export the trained neural network model to a file.

3. Using a trained neural network in LabVIEW environment using ANNAPI

At this stage, we already have a trained neural network saved in a text file with .ann extension (for example, TrainModel_lv.ann), we need to get the License Content by using valid username and password in GetLicenseContent.vi. Assume that we do not specify any License File Path in GetLicenseContent.vi, so this VI will generate the license content, ANNLV.lic, in the working directory.

Note: We only need to get the license content only one time for a given target PC as this license content file can be used in other application running in the same PC.

With a trained neural network model and a license content, we can create a neural network model using Create.vi. Following block diagram demonstrates 5 steps to use ANNAPI to load a trained neural network and a license content file in order to create a neural network model to approximate sine wave.

Block diagram

Front Panel