0
$\begingroup$

Unfortunately I won't be able to provide a MWE, as it would be too big and complex, and this question will be based on pure semantics, basically (and I understand if this is impossible to answer in this way).

In any case, I have written a program which starts and trains a multilayer feedforward backpropagating neural network. I don't expect it to be or intend to make it useful in practice, as it is not optimized at all (and runs in my CPU) and I wouldn't know how to optimize it or if it is even possible in Mathematica. The point is that it is just an exercise.

Nonetheless, I would like to be able to run it on simple cases. It has already worked learning the OR and XOR logical operators, so by 'simple' I mean something a little more involved.

One of the things I believe to be spoiling its functionality (both in efficiency and in efficacy) are small numbers, as I get countless warnings of the type

"19.4806\ 2.440253060325*10^-412 is too small to represent as a
normalized machine number; precision may be lost"

Now it only appears on forms of powers of ten as I have replaced an appearing Exponential by a form which defaults to zero for small enough argument.

In any case, my question is: do you have any suggestion as to how deal with this globally? I have no idea what would be a convenient way to make Mathematica treat every number to a given precision (or if that even is what I want).

$\endgroup$
4
  • 3
    $\begingroup$ "Unfortunately I won't be able to provide a MWE, as it would be too big and complex" - nah, you don't get out of doing your due diligence this easily :-) the point of a MINIMAL working example is that YOU work to reduce your problem to its most important point, or potentially generate a new, smaller and similar problem for us to work on. Otherwise, we can only guess. $\endgroup$
    – MarcoB
    Commented Aug 31, 2023 at 14:27
  • 2
    $\begingroup$ Machine numbers are represented by binary digits: d1, d2,..dmax and an exponent: ex like: 1.d1 d2 dmax x 2^ex,(note the starting "1")) where emin<= ex <= emax. These number are called "normalized machine numbers". It is clear that numbers smaller than 2'^emin can not be represented like this. They must be written with a starting zero. Therefore, we have at least one digit less, what account for the loss in precision. What you can do is to use rational numbers that do not have this problem, but the computing time may be much longer. $\endgroup$ Commented Aug 31, 2023 at 14:37
  • $\begingroup$ @MarcoB oh, of course I could work on a version of the code which reproduces the problem in the appropriate context and which was suitable for readers to understand. That is indeed way out of hand, however -- I have no shame admitting. My hopes were that the question, in its wordy form, is within the site parameters while being enough for some general suggestions I could try to wrap my head around. $\endgroup$
    – GaloisFan
    Commented Aug 31, 2023 at 16:12
  • $\begingroup$ @DanielHuber thank you very much! I will see what I can do to test how the program works with exact precision calculations. $\endgroup$
    – GaloisFan
    Commented Aug 31, 2023 at 16:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.