Is it possible truncate a neural network weights?

When I am training a neural network I get the weights e.g. 0.960928653806898,0.273172876012661, ..., -0.413223736485805, but is possible modify the weights to obtain only the integer part and 2 digits to the fracctional part?

 Akzeptierte Antwort

Greg Heath
Greg Heath am 4 Nov. 2014
Bearbeitet: Greg Heath am 6 Nov. 2014
Set the display format at the beginning of the program. It will not affect the accuracy of internal function calculations.
help format
doc format
e.g.,
a = 0.960928653806898; b=0.273172876012661; c=-0.413223736485805;
format short
a,b,c
%a = 0.96093
%b = 0.27317
%c = -0.41322
Hope this helps.
Thank you for formally accepting my answer
Greg

1 Kommentar

Image Analyst
Image Analyst am 7 Nov. 2014
Bearbeitet: Image Analyst am 7 Nov. 2014
Ana's answer moved here (It seems like Ana and Shana are the same person with two accounts):
Hi Greg, thank you for answer my question. At the beginning of the program I write "format compact" and with this command I visualize weights like: 0.9609,0.2731, ..., -0.4132. However, I know matlab weights are obtained randomly. But is possible truncate the randomly number using a function like round2 to obtain weights like 0.96,0.27, ..., -0.41?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Hilfe-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