# Multi inputs/outputs signal prediction

Medium
1 hours
February 5, 2023
Youssef MENJOUR This example aim to explain how to design, train and integrate in LabVIEW environment a multi dimentions inputs / outputs model using mathematical function dataset (Cosine and Square).

## Diagram global overview

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

The architecture is composed of 3 sequential states. (Design model, Prepare data, Training model).

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

This model has two inputs and two outputs. Input 1 and input 2 are totaly independant and each inputs has his own prediction (output 1 and output 2).
Output 1 is the prediction of input 1 and output 2 is the prediction of input 2.
Input 1 is a 1D tensor, input 2 is a 2D tensor, ouput 1 is a 2D tensor and ouput 2 is a 1D tensor.

One particularity of this model is that the dimension of Input tensor is volontary different from his output (1D –> 2D and 2D –> 1D).
The idea is to train this model to predict Cosine and Square signal for each couple of input/output.  Input 1 is a 1D tensor of 6 values. We expect the model to predict like a square function all these values at output 1 which is a 2D tensor.
To display the data, we transform the 2D array into a 1D array. Input 2 is a 2D tensor of 6 values (3X2). We expect the model to predict like a cosine function all these values  at output 2 which is a 1D tensor.
As input 2  is a 2D tensor we reshape to  1D tensor before the concatenate layer.

### Model train

The model train process is “classic”, we repeat a sequence of Forward – Loss – Backward to process to the train of the model for each couple of inputs/outputs.

### Model test

Testing model consist to forward and display features after batches during the training.

## How to acces to this example ?

The Multi inputs outputs model train example is available in the LabVIEW find example session. Use the Keywords “Multi”  “inputs” 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.