{"id":26158736,"url":"https://github.com/dselivanov/ftrl","last_synced_at":"2025-06-26T13:35:02.631Z","repository":{"id":72401815,"uuid":"79446521","full_name":"dselivanov/FTRL","owner":"dselivanov","description":"R/Rcpp implementation of the 'Follow-the-Regularized-Leader' algorithm","archived":false,"fork":false,"pushed_at":"2018-03-26T14:12:46.000Z","size":122,"stargazers_count":50,"open_issues_count":2,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-19T06:12:12.704Z","etag":null,"topics":["ftrl","logistic-regression","machine-learning","r","sgd"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dselivanov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-01-19T11:24:00.000Z","updated_at":"2025-03-03T19:49:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"92b56d77-82c7-461e-946f-1af9a3f0a0aa","html_url":"https://github.com/dselivanov/FTRL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dselivanov/FTRL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dselivanov%2FFTRL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dselivanov%2FFTRL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dselivanov%2FFTRL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dselivanov%2FFTRL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dselivanov","download_url":"https://codeload.github.com/dselivanov/FTRL/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dselivanov%2FFTRL/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262076996,"owners_count":23255096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ftrl","logistic-regression","machine-learning","r","sgd"],"created_at":"2025-03-11T10:59:55.073Z","updated_at":"2025-06-26T13:35:02.608Z","avatar_url":"https://github.com/dselivanov.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NOW PART OF [rsparse](https://github.com/dselivanov/rsparse)\n\n## What is this?\n\nR package which implements [Follow the proximally-regularized leader](http://www.jmlr.org/proceedings/papers/v15/mcmahan11b/mcmahan11b.pdf) algorithm. It allows to solve very large problems with stochastic gradient descend online learning. See [Ad Click Prediction: a View from the Trenches](https://www.eecs.tufts.edu/~dsculley/papers/ad-click-prediction.pdf) for example.\n![ftrl_algo](docs/FTRL_algo.png)\n\n## Features\n\n- Online learning - can easily learn model in online fashion\n- Fast (I would say very fast) - written in `Rcpp`\n- Parallel, asyncronous. Benefit from multicore systems (if your compiler supports openmp) - [Hogwild!](https://arxiv.org/abs/1106.5730) style updates under the hood\n\n## Notes\n\n- Only logistic regerssion implemented at the moment\n- Core input format for matrix is CSR - `Matrix::RsparseMatrix`. Hoewer common R `Matrix::CpasrseMatrix` ( aka `dgCMatrix`) will be converted automatically\n\n## Todo list\n\n- gaussian, poisson family\n- vignette\n- improve test coverage (but package battle tested on [kaggle outbrain competition](https://www.kaggle.com/c/outbrain-click-prediction) and contribute to our 13 place)\n\n## Quick reference\n\n```r\nlibrary(Matrix)\nlibrary(FTRL)\nN_SMPL = 5e3\nN_FEAT = 1e3\nNNZ = N_SMPL * 30\n\nset.seed(1)\ni = sample(N_SMPL, NNZ, TRUE)\nj = sample(N_FEAT, NNZ, TRUE)\ny = sample(c(0, 1), N_SMPL, TRUE)\nx = sample(c(-1, 1), NNZ, TRUE)\nodd = seq(1, 99, 2)\nx[i %in% which(y == 1) \u0026 j %in% odd] = 1\nm = sparseMatrix(i = i, j = j, x = x, dims = c(N_SMPL, N_FEAT), giveCsparse = FALSE)\nX = as(m, \"RsparseMatrix\")\n\nftrl = FTRL$new(alpha = 0.01, beta = 0.1, lambda = 20, l1_ratio = 1, dropout = 0)\nftrl$partial_fit(X, y, nthread = 1)\naccuracy_1 = sum(ftrl$predict(X, nthread = 1) \u003e= 0.5 \u0026 y) / length(y)\n\nw = ftrl$coef()\n\n\nftrl$partial_fit(X, y, nthread = 1)\naccuracy_2 = sum(ftrl$predict(X, nthread = 1) \u003e= 0.5 \u0026 y) / length(y)\n\naccuracy_2 \u003e accuracy_1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdselivanov%2Fftrl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdselivanov%2Fftrl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdselivanov%2Fftrl/lists"}