We need to do a logistic regression in Java. We used this code in Python http://blog.smellthedata.com/2009/06/python-logistic-regression-with-l2.html and basically want the same thing in Java. I was directed to Weka, but the license is non-commercial.
I found the Omegahat API has the BFGS minimizer like Scipy, but I can't figure out the API: http://www.omegahat.org/api/org/omegahat/Numerics/Optimizers/OptimizerAlgorithmBFGS.html I want to implement a class with the model and put in the likelihood functions. But the model.eval takes a ModelPointNumeric which also has an eval. In any case, it is not clearly correlated with the math as the python code using numpy is. Is the omegahat api used or maintained? I could not find a mailing list for it.
If you do not find anything else, take a look at Apache Commons Math: it is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang.
Good luck.
Thanks for the inputs. After much searching I found this: http://mallet.cs.umass.edu/optimization.php This is almost a 1:1 translation of how the numpy implementation works, it allows us to do logistic regression ourselves with the mathematical formulas. So I can take our python class and implement the 4-5 methods necessary and then pass it to the BFGS solver to perform our logistic regression.
It worked great, the only thing we had to realize was that Mallet maximizes the function and Numpy has a minimizer.
Weka has commercial version of a license, see this page for details.
However, if logistic regression is the only data mining technique you need, take a look at LIBLINEAR, which is distributed under BSD license.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With