1

I'm trying to do the AdaBoost algorithm and to obtain the confidence value I used this formula:

 Double valorConfianza = (1/2) * (Math.log10(1-tasaErrorMenor/tasaErrorMenor)/Math.log10(2)) ;

But it didn't work so I print the values and it gave me this:

tasaErrorMenor: 0.121837094
valorConfianza: NaN

Why does this happen, if my calculator gives me a normal number?

Andrew Tobilko
  • 48,120
  • 14
  • 91
  • 142
EndergirlPG
  • 61
  • 1
  • 2
  • I would have expected 0 because `1/2 == 0` (you are doing integer division there). – Jesper Dec 16 '18 at 14:56
  • 3
    Also, `1-tasaErrorMenor/tasaErrorMenor` is 0 because division is done before subtraction. And then you take the `log10` of `0`... – Jesper Dec 16 '18 at 14:57
  • 2
    `(1 / 2.0) * (Math.log10((1 - tasaErrorMenor) / tasaErrorMenor) / Math.log10(2))`, this seems to work, if your intention was to `1 - tasaErrorMenor` first and then divide that by `tasaErrorMenor`. – Mark Dec 16 '18 at 14:58

0 Answers0