{"id":15063999,"url":"https://github.com/jameschapman19/scikit-prox","last_synced_at":"2025-04-10T11:50:41.138Z","repository":{"id":65532184,"uuid":"594093945","full_name":"jameschapman19/scikit-prox","owner":"jameschapman19","description":"A package for fitting regularized models from scikit-learn via proximal gradient descent","archived":false,"fork":false,"pushed_at":"2023-06-28T13:50:44.000Z","size":107,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T10:38:51.784Z","etag":null,"topics":["proximal-gradient-descent","regularization","scikit-learn","scikit-learn-api"],"latest_commit_sha":null,"homepage":"https://scikit-prox.readthedocs.io/en/latest/","language":"Python","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/jameschapman19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.rst","funding":null,"license":"LICENSE.md","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":"2023-01-27T15:31:37.000Z","updated_at":"2023-03-10T11:56:18.000Z","dependencies_parsed_at":"2024-09-25T00:10:06.146Z","dependency_job_id":"fc316f26-46fc-47d7-9186-3de5c5033c8f","html_url":"https://github.com/jameschapman19/scikit-prox","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameschapman19%2Fscikit-prox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameschapman19%2Fscikit-prox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameschapman19%2Fscikit-prox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameschapman19%2Fscikit-prox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jameschapman19","download_url":"https://codeload.github.com/jameschapman19/scikit-prox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215192,"owners_count":21066619,"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":["proximal-gradient-descent","regularization","scikit-learn","scikit-learn-api"],"created_at":"2024-09-25T00:09:58.088Z","updated_at":"2025-04-10T11:50:41.120Z","avatar_url":"https://github.com/jameschapman19.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/jameschapman19/scikit-prox/branch/main/graph/badge.svg?token=Id6VAqEdoc)](https://codecov.io/gh/jameschapman19/scikit-prox)\n![Build Status](https://github.com/jameschapman19/scikit-prox/actions/workflows/test.yml/badge.svg)\n[![Documentation Status](https://readthedocs.org/projects/scikit-prox/badge/?version=latest)](https://scikit-prox.readthedocs.io/en/latest/?badge=latest)\n[![version](https://img.shields.io/pypi/v/scikit-prox)](https://pypi.org/project/scikit-prox/)\n[![downloads](https://img.shields.io/pypi/dm/scikit-prox)](https://pypi.org/project/scikit-prox/)\n\n# Scikit-Prox\nThe goal of this project is to implement a set of algorithms for solving the following optimization problem:\nminimize f(x) + g(x) where f is a smooth function and g is a proximal operator. The proximal operator of a function g is defined as:\nproxg(λx) = argmin y g(y) + 1/2λ‖y − x‖2\n\n## Installation\nTo install the package, run the following command:\npip install scikit-prox\n\n## Usage\n\n### Example 1: Lasso\nThe following code solves the following optimization problem:\nminimize 1/2‖Ax − b‖2 + λ‖x‖1\n\n```python\nimport numpy as np\nfrom scipy import sparse\nfrom sklearn.datasets import make_regression\nfrom sklearn.linear_model import Lasso\nfrom skprox.linear_model import RegularisedLinearRegression\n\n# Generate data\nX, y = make_regression(n_samples=100, n_features=1000, random_state=0, noise=4.0, bias=100.0)\nX = sparse.csr_matrix(X)\n\n# Solve the problem using scikit-learn\nmodel = Lasso(alpha=0.1)\nmodel.fit(X, y)\nprint(\"scikit-learn solution: {}\".format(model.coef_))\n\n# Solve the problem using scikit-prox\nmodel = RegularisedLinearRegression(proximal='L1', sigma=0.1)\nmodel.fit(X, y)\nprint(\"scikit-prox solution: {}\".format(model.coef_))\n```\n\n### Example 2: Total Variation Regression\nThe following code solves the following optimization problem:\nminimize 1/2‖Ax − b‖2 + λ‖∇x‖1\n\n```python\nimport numpy as np\nfrom scipy import sparse\nfrom sklearn.datasets import make_regression\nfrom skprox.linear_model import RegularisedLinearRegression\n\n# Generate data\nX, y = make_regression(n_samples=100, n_features=1000, random_state=0, noise=4.0, bias=100.0)\nX = sparse.csr_matrix(X)\n\n# Solve the problem using scikit-prox\nmodel = RegularisedLinearRegression(proximal='TV', sigma=0.1)\nmodel.fit(X, y)\nprint(\"scikit-prox solution: {}\".format(model.coef_))\n```\n\n### Example 3: Grid Search\nThe following code solves the following optimization problem:\nminimize 1/2‖Ax − b‖2 + λ‖x‖1\n\n```python\nimport numpy as np\nfrom scipy import sparse\nfrom sklearn.datasets import make_regression\nfrom sklearn.linear_model import Lasso\nfrom skprox.linear_model import RegularisedLinearRegression\nfrom sklearn.model_selection import GridSearchCV\n\n# Generate data\nX, y = make_regression(n_samples=100, n_features=1000, random_state=0, noise=4.0, bias=100.0)\nX = sparse.csr_matrix(X)\n\n# Solve the problem using scikit-learn\nmodel = Lasso()\ngrid = GridSearchCV(model, {'alpha': [0.1, 0.2, 0.3]})\ngrid.fit(X, y)\nprint(\"scikit-learn solution: {}\".format(grid.best_estimator_.coef_))\n\n# Solve the problem using scikit-prox\nmodel = RegularisedLinearRegression(proximal='L1')\ngrid = GridSearchCV(model, {'sigma': [0.1, 0.2, 0.3]})\ngrid.fit(X, y)\nprint(\"scikit-prox solution: {}\".format(grid.best_estimator_.coef_))\n```\n\n\n## Documentation\nThe documentation is available at https://scikit-prox.readthedocs.io/en/latest/\n\n## License\nThis project is licensed under the MIT License - see the LICENSE.md file for details\n\n## Acknowledgments\nThis project leans on the pyproximal package borrowing all the proximal operators except for Total Variation which\nis implemented using functions from skimage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameschapman19%2Fscikit-prox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjameschapman19%2Fscikit-prox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameschapman19%2Fscikit-prox/lists"}