下载和日志值在java [英] underflow and log values in java

查看:166
本文介绍了下载和日志值在java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于在机器学习模型中处理小概率值的问题。



避免下溢问题的标准方法是从小的浮点数乘以结果是使用log(x)而不是x



假设x = 0.50,其日志是log(x)= - 0.301029996



以稍后恢复的值exp(log( x))!= x这是



0.740055574!= 0.50



那么,如何使用对数有用的处理下溢?

解决方案

这与溢出无关。在第一个日志中,您可以计算基数10中的 log ,而不是自然对数。您可以这样做:



提高 10 ^ log(x)以获取 x ,或使用自然对数。


I have a question in regard to dealing with small probabilities values in machine learning models.

The standard way to avoid underflow problems which results from multiplying small floating-point numbers is to use log(x) instead of x

suppose that x=0.50 the log of which is log(x)=-0.301029996

to recover x later on the value of exp(log(x)) != x that is

0.740055574 != 0.50

So, how is using the logarithm is useful to deal with underflow??

解决方案

This has nothing to do with the overflow. In the first log, you compute the log in base 10, instead of the natural logarithm. You can do this:

raise 10^log(x) to get back x, or use the natural logarithm.

这篇关于下载和日志值在java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆