Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chisquareScore = stats.n * Math.pow(N11 * N00 - N10 * N01, 2) / ((N11 + N01) * (N11 + N10) * (N10 + N00) * (N01 + N00))计算值溢出 #1075

Closed
sd1026203 opened this issue Jan 4, 2019 · 1 comment
Labels

Comments

@sd1026203
Copy link

sd1026203 commented Jan 4, 2019

ChiSquareFeatureExtractor中的这行代码N11等变量均为int型, 计算时会引发数值溢出, 虽然不会报错, 但是计算结果是错误的
2000L * 82 * 2001 * 3919 = 1286074716000
但是实际程序中:
2000 * 82 * 2001 * 3919 = 1879494496,这个值是错误的, 导致卡方检测运算结果其实是错误的

@hankcs hankcs closed this as completed in 179a373 Jan 4, 2019
@hankcs hankcs added the bug label Jan 4, 2019
@hankcs
Copy link
Owner

hankcs commented Jan 4, 2019

感谢反馈,已经修复,请参考上面的commit。
如果还有问题,欢迎重开issue。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants