{"id":19267033,"url":"https://github.com/mljs/regression-polynomial","last_synced_at":"2025-04-09T22:12:57.091Z","repository":{"id":20348335,"uuid":"89707429","full_name":"mljs/regression-polynomial","owner":"mljs","description":"Polynomial Regression","archived":false,"fork":false,"pushed_at":"2024-10-16T15:27:35.000Z","size":1307,"stargazers_count":17,"open_issues_count":1,"forks_count":3,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-09T22:12:51.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mljs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2017-04-28T13:14:02.000Z","updated_at":"2025-02-27T17:30:29.000Z","dependencies_parsed_at":"2024-01-31T06:46:59.913Z","dependency_job_id":"9c2d429d-7726-4896-b3ab-3c4b86ad1209","html_url":"https://github.com/mljs/regression-polynomial","commit_stats":{"total_commits":37,"total_committers":6,"mean_commits":6.166666666666667,"dds":0.5135135135135135,"last_synced_commit":"d8a20894e9581df908eec3789e8db118d08d5426"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fregression-polynomial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fregression-polynomial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fregression-polynomial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fregression-polynomial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mljs","download_url":"https://codeload.github.com/mljs/regression-polynomial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119292,"owners_count":21050755,"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":[],"created_at":"2024-11-09T20:09:34.398Z","updated_at":"2025-04-09T22:12:57.068Z","avatar_url":"https://github.com/mljs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# regression-polynomial\n\n[![NPM version][npm-image]][npm-url]\n[![npm download][download-image]][download-url]\n[![build status][ci-image]][ci-url]\n[![Test coverage][codecov-image]][codecov-url]\n\nPolynomial Regression.\n\n## Installation\n\n`$ npm i ml-regression-polynomial`\n\n## Usage\n\n```js\nimport { PolynomialRegression } from 'ml-regression-polynomial';\n\nconst x = [50, 50, 50, 70, 70, 70, 80, 80, 80, 90, 90, 90, 100, 100, 100];\nconst y = [\n  3.3, 2.8, 2.9, 2.3, 2.6, 2.1, 2.5, 2.9, 2.4, 3.0, 3.1, 2.8, 3.3, 3.5, 3.0,\n];\nconst degree = 5; // setup the maximum degree of the polynomial\n\nconst regression = new PolynomialRegression(x, y, degree);\n\nconsole.log(regression.predict(80)); // Apply the model to some x value. Prints 2.6.\nconsole.log(regression.coefficients); // Prints the coefficients in increasing order of power (from 0 to degree).\nconsole.log(regression.toString(3)); // Prints a human-readable version of the function.\nconsole.log(regression.toLaTeX());\nconsole.log(regression.score(x, y));\n```\n\n## Options\n\nAn `interceptAtZero` option is available, to force $f(0) = 0$. Also, a \"powers array\" can be specified.\n\n- Using `interceptAtZero`\n\n```js\nconst regression = new PolynomialRegression(x, y, degree, {\n  interceptAtZero: true,\n});\n```\n\n- Using the powers array\n\n```js\nconst powers = [0, 1, 2, 3, 4, 5];\nconst regression = new PolynomialRegression(x, y, powers);\n```\n\n`powers` could also be `[1,2,3,4,5]`or`[1,3,5]` and so on.\n\nFor intercepting at zero using an array, skip the zero in the array (the option `interceptAtZero` is ignored in this case.)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/ml-regression-polynomial.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/ml-regression-polynomial\n[download-image]: https://img.shields.io/npm/dm/ml-regression-polynomial.svg?style=flat-square\n[download-url]: https://npmjs.org/package/ml-regression-polynomial\n[codecov-image]: https://img.shields.io/codecov/c/github/mljs/regression-polynomial.svg\n[codecov-url]: https://codecov.io/gh/mljs/regression-polynomial\n[ci-image]: https://github.com/mljs/regression-polynomial/workflows/Node.js%20CI/badge.svg?branch=main\n[ci-url]: https://github.com/mljs/regression-polynomial/actions?query=workflow%3A%22Node.js+CI%22\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fregression-polynomial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmljs%2Fregression-polynomial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fregression-polynomial/lists"}