# Linear Integer Output from a Neural Network

4 Ansichten (letzte 30 Tage)
James Mathieson am 27 Feb. 2015
Kommentiert: Mithun Goutham am 9 Jun. 2020
I am trying to construct a custom neural network for regression that gives its response in whole integers rather than in continuous real numbers. This is done because the target data is also in whole integers and fractional amounts are meaningless to the application.
At first blush, I thought the solution here would be to create a copy of the purelin transfer function and sub-functions with the a=n term replaced with a=round(n). However, this seems to create only 3 discrete steps. On further inspection when the custom function runs, the inputs to the function are all bounded to [-1 1], resulting in round(n) converting them to -1, 0, or 1. Given that the purelin template is unbound, I can only surmise that there is a separate function which scales the input back up to the value range after the transfer function.
So, the question is, what function for the layer actually determines the final output? How can I achieve my aim of getting a network to output whole integers? As a note, just rounding the result after the fact is not an acceptable solution as the integer nature of the output needs to be considered when calculating the performance of the network during training.
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Greg Heath am 1 Mär. 2015
It is hard to believe that the integer nature of the output has to be considered during training.
Mithun Goutham am 9 Jun. 2020
James Mathieson, I am in a similar fix, and was wondering if you were able to implement this within the neural network training. From what I understand, rounding within the neural network allows the RMSE to consider that when setting weights and biases, which would be different from rounding off the final value. While this may cause convergence to bounce up and down, I believe it should trend towards a lower RMSE.

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Greg Heath am 27 Mai 2020
The integer nature of the output DOES NOT HAVE TO BE CONSIDERED during training.
It is sufficient to round the real valued output.
Hope is helps.
Greg
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Define Shallow Neural Network Architectures finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by