{"id":21028533,"url":"https://github.com/dirkschumacher/ftrljs","last_synced_at":"2026-05-22T05:33:05.963Z","repository":{"id":145906488,"uuid":"195525794","full_name":"dirkschumacher/ftrljs","owner":"dirkschumacher","description":"FTRL-Proximal online learning algorithm for logistic regression in javascript","archived":false,"fork":false,"pushed_at":"2023-03-01T12:40:24.000Z","size":18,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T15:11:29.759Z","etag":null,"topics":["ftrl","javascript","logistic-regression","machine-learning-algorithms","online-learning-algorithms"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/dirkschumacher.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-06T10:14:28.000Z","updated_at":"2023-07-25T14:27:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea7283df-deee-41c6-b5fa-c1d14305d3f0","html_url":"https://github.com/dirkschumacher/ftrljs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkschumacher%2Fftrljs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkschumacher%2Fftrljs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkschumacher%2Fftrljs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkschumacher%2Fftrljs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dirkschumacher","download_url":"https://codeload.github.com/dirkschumacher/ftrljs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243467024,"owners_count":20295309,"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","javascript","logistic-regression","machine-learning-algorithms","online-learning-algorithms"],"created_at":"2024-11-19T11:56:06.208Z","updated_at":"2025-12-30T05:40:11.258Z","avatar_url":"https://github.com/dirkschumacher.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dense FTRL-Proximal online learning algorithm for logistic regression\n\nAn _experimental_ implementation of the FTRL online learning algorithm for logistic regression in plain javascript.\n\nImplemented as in this\n[paper](https://www.eecs.tufts.edu/%7Edsculley/papers/ad-click-prediction.pdf).\n\n\n```js\nconst optimizer = ftrl(\n  3, // the number of features in your training examples \n  10, // lambda1 - use this parameter for l1 regularitzation\n  2, // lambda2 - use this parameter for l2 regularitzation\n  0.1, // alpha - parameters that control the learning rate (see Eq. 2)\n  1 // beta - parameters that control the learning rate (see Eq. 2). 1 seems to be a good default value here\n)\n\n// pass one training example (an array) and the result (a number) at a time\noptimizer.fit([1, 2, 3], 1)\noptimizer.fit([1, 4, 3], 1)\noptimizer.fit([1, 7, 3], 0)\n\n// you can then predict the result for unseen examples\noptimizer.predict([2, 3, 4])\n\n// or just get the weights\noptimizer.weights()\n\n// ore store everything for later\nconst checkpoint = optimizer.save()\n// ...\nconst newOptimizer = ftrl()\nnewOptimizer.load(checkpoint)\n```\n\n## API\n\n* `ftrl()` creates a new optimizer/model\n* `fit()` fits a single training example (array + result)\n* `predict()` takes an array and returns the prediction (number between 0 and 1)\n* `weights()` computes and returns the weights\n* `save()` export the current state of the optimizer to an object\n* `load()` restore a optimizer from a previously saved state\n\n\n## Memory\n\nThe algorithm stores three dense arrays in the size of the features. If your number of features is too large, a sparse implementation of the algorithm can be used.\n\n## References\n\nMcMahan, H. Brendan, et al. “Ad click prediction: a view from the\ntrenches.” Proceedings of the 19th ACM SIGKDD international conference\non Knowledge discovery and data mining. ACM, 2013.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirkschumacher%2Fftrljs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirkschumacher%2Fftrljs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirkschumacher%2Fftrljs/lists"}