I was using Logistic regression to train my data. In this process, I need calculate a sigmoid function coded like:
private double sigmoid(double x) {
return 1.0 / (1 + Math.pow(Math.E, -1 * x));
}
So if my x is large than 36, it always return 1.0, and I will get Infinity in log(1 - sigmoid(x)).
I guess java is not a good language at machine-learning, I just need apply in this project.
I also know Java's precision principle through this question, But I still want to know is there anyway to solve this problem.