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?

 Réponse acceptée

Greg Heath
Greg Heath le 4 Nov 2014
Modifié(e) : Greg Heath le 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 commentaire

Image Analyst
Image Analyst le 7 Nov 2014
Modifié(e) : Image Analyst le 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?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by