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?

 Accepted Answer

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 Comment

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?

Sign in to comment.

More Answers (0)

Categories

Asked:

on 3 Nov 2014

Edited:

on 7 Nov 2014

Community Treasure Hunt

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

Start Hunting!