{"id":19031857,"url":"https://github.com/andydevs/optipy","last_synced_at":"2026-05-13T13:48:43.599Z","repository":{"id":108735448,"uuid":"65444716","full_name":"andydevs/optipy","owner":"andydevs","description":"Optimization algorithms written in python","archived":false,"fork":false,"pushed_at":"2017-02-24T21:16:53.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T04:20:41.634Z","etag":null,"topics":["numpy","optimization","optimization-algorithms"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andydevs.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-08-11T06:32:44.000Z","updated_at":"2018-05-11T22:13:03.000Z","dependencies_parsed_at":"2023-06-04T13:30:34.466Z","dependency_job_id":null,"html_url":"https://github.com/andydevs/optipy","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"fefd0be8f3a53a75eec40020b585aef4b8eda7be"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andydevs%2Foptipy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andydevs%2Foptipy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andydevs%2Foptipy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andydevs%2Foptipy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andydevs","download_url":"https://codeload.github.com/andydevs/optipy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240081543,"owners_count":19745066,"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":["numpy","optimization","optimization-algorithms"],"created_at":"2024-11-08T21:25:29.660Z","updated_at":"2026-05-03T11:30:19.431Z","avatar_url":"https://github.com/andydevs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OptiPy\n\nAn optimization library written only with numpy.\n\n```python\noptipy.minimize(lambda x: 0.5*numpy.sum(x**2), 2)\n```\n\n## Quick Start Guide\n\nMake sure you have numpy installed first.\n\nDefine a function (using `lambda` or `def`). This function must contain one input argument (a numpy array) and return a scalar output.\n\n```python\nimport numpy\n\nfunction = lambda x: 0.5*numpy.sum(x**2)\n```\n\nUse `optipy.minimize` to return the minimum of the function. Pass your function and the number of input arguments to minimize.\n\n```python\nimport numpy\nimport optipy\n\nfunction = lambda x: 0.5*numpy.sum(x**2)\nminimum  = optipy.minimize(function, 2)\n\n# minimum = approx. [0., 0.]\n```\n\nLikewise, use `optipy.maximize` to return the maximum of the function.\n\n```python\nimport numpy\nimport optipy\n\nfunction = lambda x: -0.5*numpy.sum(x**2)\nmaximum  = optipy.maximize(function, 2)\n\n# maximum = approx. [0., 0.]\n```\n\n## Optional Parameters\n\nYou can pass additional keyword arguments to the minimize/maximize functions to control their behaviour.\n\n```python\noptipy.minimize(func, 2, epsilon=1e-11, delta=1e-3)\n```\n\nThe following parameters are valid:\n\n| Argument | Description                                  | Defaults   |\n|:---------|:---------------------------------------------|:-----------|\n| epsilon  | Zero slope threshold                         | 1e-10      |\n| delta    | Delta value used to compute gradient/hessian | 1e-6       |\n| alpha    | Step size, or learning rate                  | 1e-4       |\n| maxiter  | Maximum iterations                           | sys.maxint |\n\n## Optimization Algorithms\n\nBy default, optipy uses the Batch Gradient Descent algorithm, but also has other algorithms that can be used, either by calling them directly (they use the same interface as minimize and maximize), or by setting `default_optimizer` to the preferred algorithm to be used by `minimize/maximize`.\n\n```python\noptipy.default_optimizer = optipy.gradient_descent.stochastic\n```\n\nHere are the available algorithms:\n\n| Function                           | Description                                                  |\n|:-----------------------------------|:-------------------------------------------------------------|\n| optipy.gradient_descent.batch      | Batch Gradient Descent                                       |\n| optipy.gradient_descent.stochastic | Stochastic Gradient Descent                                  |\n| optipy.newtonian.pure              | Newton's Method. Computes the full Hessian in each iteration |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandydevs%2Foptipy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandydevs%2Foptipy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandydevs%2Foptipy/lists"}