https://github.com/vinhkhuc/lbfgs4j
Java version of liblbfgs: http://www.chokkan.org/software/liblbfgs/
https://github.com/vinhkhuc/lbfgs4j
java machine-learning optimization
Last synced: 5 months ago
JSON representation
Java version of liblbfgs: http://www.chokkan.org/software/liblbfgs/
- Host: GitHub
- URL: https://github.com/vinhkhuc/lbfgs4j
- Owner: vinhkhuc
- License: mit
- Created: 2015-06-08T03:41:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-12-16T01:39:26.000Z (over 5 years ago)
- Last Synced: 2025-07-28T22:49:14.221Z (11 months ago)
- Topics: java, machine-learning, optimization
- Language: Java
- Size: 33.2 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is a direct Java port of [liblbfgs](http://www.chokkan.org/software/liblbfgs/), a library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS).
The L-BFGS optimization method is used to solve unconstrained minimization problem:
minimize f(x), where x = (x1, x2, ... xn)
f(x) and its gradient are computable.
This library also includes the implementation of the Orthant-Wise Limited-memory Quasi-Newton (OWL-QN) method which is used to minimize the function f(x) + C|x|, where C is a positive number.
### Maven dependency
```xml
com.github.vinhkhuc
lbfgs4j
0.2.1
```
### Usage example
Find the minimum value of the function f(x) = (x-5)^2 + 1.
```java
import com.github.lbfgs4j.liblbfgs.Function;
import com.github.lbfgs4j.LbfgsMinimizer;
...
Function f = new Function() {
public int getDimension() {
return 1;
}
public double valueAt(double[] x) {
return Math.pow(x[0]-5, 2) + 1;
}
public double[] gradientAt(double[] x) {
return new double[] { 2*(x[0]-5) };
}
};
LbfgsMinimizer minimizer = new LbfgsMinimizer();
double[] x = minimizer.minimize(f); // x should be [5]
double min = f.valueAt(x); // min should be 1
```
The OWL-QN method will be used when initializing the minimizer with, for example, ```new LbfgsMinimizer(1.0)```, here 1.0 is the coefficient for |x|.
Other parameters such as memory size, maximum number of iterations, etc. can be set using the class ```LBFGS_Param```.
### License
lbfgs4j is released under the MIT License (see the LICENSE file for details).
### References
This library is used in several projects:
1. Moment-Based Quantile Sketches for Efficient High Cardinality Aggregation Queries. Edward Gan, Jialin Ding, Kai Sheng Tai, Vatsal Sharan, Peter Bailis. VLDB 2018. ([paper](https://dl.acm.org/doi/10.14778/3236187.3236212))
2. Humio, Log Management at Scale. ([acknowledgement](https://docs.humio.com/third-party-licenses/))