# Signal prediction Dense neural network

Easy
1 hours
January 13, 2023
Youssef MENJOUR

This example aim to explain how to design, train and integrate in LabVIEW environment a 1D DNN model using mathematical function dataset.

## Front panel overview

In this section we will present the front panel.

The user interface is relatively simple. The user can setup two enumerators (dataset and neural activation parameters)

## Diagram global overview

This section show how the model and HAIBAL functionalities are integrated inside a LabVIEW architecture design.

The architecture is a state machine. It’s composed of 10 states. (Init, Create model, init graph, create dataset, split dataset, configure graph, train, display, timer, idle and restart).

This image is the complete example as snippet PNG, you can drop this snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install HAIBAL library to run it).

### Model design

As we just want to train the model to a mathematical function type F(x) = y with x type is a single and y type single.
So input will be a 1D vector with only 1 value. So forward data will be a 2D tensor as a batch of 1D vector. (2D array).
The model is a dense neural network composed of one input layer (1) with 3 dense layers.

The latest dense outputs shape = 1. “F(x) = Y”

We use a meansquare loss for this example. (setup at init state)

### Model train

The model train process is “classic”, we repeat a sequence of Forward – Loss – Backward to process to the train of the model.

### Model test

As all loop run in parallels, the prediction loop combined with the draw loop (user drawing interface managed by this process) make possible to test the model during the training.

Testing model consist to forward and display test set during the training.

## How to acces to this example ?

The Signal DNN example is available in the LabVIEW find example session. Use the Keyword DNN and launch it.

The LabVIEW  dense neural network using state machine is now available with the HAIBAL deep learning toolkit.

## Need help from the community

Join the GRAIPHIC community as part of a vibrant Ecosystem. This is your place to
network, ask questions, and collaborate on code with users all over the world.