| Type: | Package | 
| Title: | 'L-BFGS' Algorithm Based on 'Blaze' for 'R' and 'Rcpp' | 
| Version: | 0.1.0 | 
| Date: | 2024-05-01 | 
| Maintainer: | Ching-Chuan Chen <zw12356@gmail.com> | 
| URL: | https://github.com/ChingChuan-Chen/RcppLbfgsBlaze, https://github.com/ChingChuan-Chen/LBFGS-blaze, https://github.com/ZJU-FAST-Lab/LBFGS-Lite, https://bitbucket.org/blaze-lib/blaze/src/master/ | 
| BugReports: | https://github.com/Chingchuan-chen/RcppLbfgsBlaze/issues | 
| Description: | The 'L-BFGS' algorithm is a popular optimization algorithm for unconstrained optimization problems. 'Blaze' is a high-performance 'C++' math library for dense and sparse arithmetic. This package provides a simple interface to the 'L-BFGS' algorithm and allows users to optimize their objective functions with 'Blaze' vectors and matrices in 'R' and 'Rcpp'. | 
| Depends: | R (≥ 4.2.0) | 
| Imports: | Rcpp (≥ 1.0.0), RcppBlaze (≥ 1.0.0) | 
| LinkingTo: | Rcpp, RcppBlaze | 
| Suggests: | tinytest, microbenchmark | 
| LazyLoad: | yes | 
| Encoding: | UTF-8 | 
| License: | MIT + file LICENSE | 
| RoxygenNote: | 7.3.1 | 
| NeedsCompilation: | yes | 
| Packaged: | 2024-05-03 09:20:00 UTC; root | 
| Author: | Ching-Chuan Chen | 
| Repository: | CRAN | 
| Date/Publication: | 2024-05-14 07:43:20 UTC | 
RcppLbfgsBlaze - Rcpp interface to the L-BFGS algorithm with Blaze
Description
RcppLbfgsBlaze constructs a simple interface to the L-BFGS algorithm based on Blaze for R and Rcpp.
Details
This package provides an implementation of the L-BFGS algorithm based on Blaze for R and Rcpp. The L-BFGS algorithm is a popular optimization algorithm for unconstrained optimization problems. Blaze is a high-performance C++ math library for dense and sparse arithmetic. The package provides a simple interface to the L-BFGS algorithm and allows users to optimize their objective functions with Blaze vectors and matrices in R and Rcpp.
Using RcppLbfgsBlaze
The simplest way to get started is to create a skeleton of a package using RcppLbfgsBlaze.
The important steps are
- Include the ‘RcppBlaze.h’ and ‘lbfgs.h’ header files. 
- Import - Rcpp. LinkingTo- Rcpp,- RcppBlazeand- RcppLbfgsBlazeby adding these lines to the ‘DESCRIPTION’ file:- Imports: Rcpp (>= 1.0.0) LinkingTo: Rcpp, RcppBlaze (>= 1.0.0), RcppLbfgsBlaze 
- Link against the - BLASand- LAPACKlibraries, by adding following two lines in the ‘Makevars’ and ‘Makevars.win’ files:- PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) 
Author(s)
For RcppLbfgsBlaze: Ching-Chuan Chen Maintainer: Ching-Chuan Chen <zw12356@gmail.com>
References
- Blaze project: https://bitbucket.org/blaze-lib/blaze. 
- LBFGS-blaze: https://github.com/ChingChuan-Chen/LBFGS-blaze 
- LBFGS-Lite: https://github.com/ZJU-FAST-Lab/LBFGS-Lite 
- liblbfgs: https://github.com/chokkan/liblbfgs 
See Also
Useful links:
- Report bugs at https://github.com/Chingchuan-chen/RcppLbfgsBlaze/issues 
Logistic Regression Fitting Using L-BFGS Algorithm
Description
This function leverage blaze and LBFGS-Blaze to efficiently fit logistic regression.
Usage
fastLogisticModel(X, y)
Arguments
| X | The model matrix. | 
| y | The response vector. | 
Value
A list of L-BFGS optimization result.
Examples
X <- matrix(rnorm(5000), 1000)
coef <- runif(5, -3, 3)
y <- sapply(1 / (1 + exp(-X %*% coef)), function(p) rbinom(1, 1, p), USE.NAMES = FALSE)
fit <- fastLogisticModel(X, y)