<!-- badges: start -->

[![GitHub version](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pbreheny/biglasso/master/.version.json&style=flat&logo=github)](https://github.com/pbreheny/biglasso)
[![CRAN version](https://img.shields.io/cran/v/biglasso?logo=R)](https://cran.r-project.org/package=biglasso)
[![downloads](https://cranlogs.r-pkg.org/badges/biglasso)](https://cran.r-project.org/package=biglasso)
[![R-CMD-check](https://github.com/pbreheny/biglasso/workflows/R-CMD-check/badge.svg)](https://github.com/pbreheny/biglasso/actions)
[![codecov](https://codecov.io/gh/pbreheny/biglasso/graph/badge.svg?token=V2IDV3BG5O)](https://app.codecov.io/gh/pbreheny/biglasso)
<!-- badges: end -->

# [biglasso: Extend Lasso Model Fitting to Big Data in R](https://pbreheny.github.io/biglasso/index.html)

`biglasso` extends lasso and elastic-net linear and logistic regression models for ultrahigh-dimensional, multi-gigabyte data sets that cannot be loaded into memory. It utilizes memory-mapped files to store the massive data on the disk and only read those into memory whenever necessary during model fitting. In addition, some advanced feature screening rules are proposed and implemented to accelerate the model fitting. To the best of our knowledge, `biglasso` is the only R package that enables users to fit lasso models with data sets that are larger than available RAM, enabling big data analysis on an ordinary laptop.

For more documentation, visit the [biglasso website](https://pbreheny.github.io/biglasso/index.html).

## Installation

To install the latest stable release version from CRAN:

```r
install.packages("biglasso")
```

To install the latest development version from GitHub:

```r
remotes::install_github("pbreheny/biglasso")
```

## Features

1. It utilizes memory-mapped files to store the massive data on the disk, only loading data into memory when necessary during model fitting. Consequently, it's able to seamlessly handle out-of-core computation.
2. It is built upon pathwise coordinate descent algorithm with _warm start, active set cycling, and feature screening_ strategies, which has been proven to be one of fastest lasso solvers.
3. We develop new, adaptive feature screening rules that outperform state-of-the-art screening rules such as the sequential strong rule (SSR) and the sequential EDPP rule (SEDPP) with additional 1.5x to 4x speedup.
4. The implementation is designed to be as memory-efficient as possible by eliminating extra copies of the data created by other R packages, making `biglasso` at least 2x more memory-efficient than `glmnet`.
5. The underlying computation is implemented in C++, and parallel computing with OpenMP is also supported.

## Benchmarks

`biglasso` is substantially more memory-efficient than `glmnet`, `ncvreg`, and
`picasso` on both simulated and real data sets, is competitive with or faster than
them on computing time, and can fit lasso models on data too large to fit in RAM at
all. See [here for benchmarks](https://pbreheny.github.io/biglasso/articles/benchmarks.html).

## Reference

- Zeng Y and Breheny P (2021). The biglasso Package: A Memory- and Computation-Efficient Solver for Lasso Model Fitting with Big Data in R. R Journal, 12: 6--19. <https://doi.org/10.32614/RJ-2021-001>
- Zeng Y, Yang T, and Breheny P (2021). Hybrid safe-strong rules for efficient optimization in lasso-type problems. Computational Statistics and Data Analysis, 153: 107063. <https://doi.org/10.1016/j.csda.2020.107063>
- Wang C and Breheny P (2022). Adaptive hybrid screening for efficient lasso optimization. Journal of Statistical Computation and Simulation, 92: 2233--2256. <https://doi.org/10.1080/00949655.2021.2025376>
- Tibshirani, R., Bien, J., Friedman, J., Hastie, T., Simon, N., Taylor, J., and Tibshirani, R. J. (2012). Strong rules for discarding predictors in lasso-type problems. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 74: 245--266.
- Wang, J., Zhou, J., Wonka, P., and Ye, J. (2013). Lasso screening rules via dual polytope projection. In Advances in Neural Information Processing Systems, 1070--1078.
- Xiang, Z. J., and Ramadge, P. J. (2012, March). Fast lasso screening tests based on correlations. 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2137--2140.
- Wang, J., Zhou, J., Liu, J., Wonka, P., and Ye, J. (2014). A safe screening rule for sparse logistic regression. In Advances in Neural Information Processing Systems, 1053--1061.

## Report bugs

Open an [issue](https://github.com/pbreheny/biglasso/issues) or send an email to Patrick Breheny at <patrick-breheny@uiowa.edu>.
