{"id":20532513,"url":"https://github.com/joshdk/pygradesc","last_synced_at":"2025-12-07T06:02:44.719Z","repository":{"id":5045291,"uuid":"6205814","full_name":"joshdk/pygradesc","owner":"joshdk","description":"A simple to use gradient descent library written in python","archived":false,"fork":false,"pushed_at":"2012-10-13T22:59:04.000Z","size":392,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T02:49:11.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"openstack/swift","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshdk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-13T18:05:29.000Z","updated_at":"2021-04-22T02:55:28.000Z","dependencies_parsed_at":"2022-09-21T14:10:40.661Z","dependency_job_id":null,"html_url":"https://github.com/joshdk/pygradesc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joshdk/pygradesc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpygradesc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpygradesc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpygradesc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpygradesc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshdk","download_url":"https://codeload.github.com/joshdk/pygradesc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpygradesc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27562172,"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","status":"online","status_checked_at":"2025-12-07T02:00:07.896Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-16T00:15:18.051Z","updated_at":"2025-12-07T06:02:44.703Z","avatar_url":"https://github.com/joshdk.png","language":"Python","readme":"pygradesc\n=========\n\nAn n-dimensional gradient descent algorithm\n\n\nExample\n-------\n\n![Example output from demo.py](https://raw.github.com/joshdk/pygradesc/master/img/graph1.png \"Example output from demo.py\")\n\n\nUsage\n-----\n\n### Importing\n\n```python\nimport pygradesc as gd\n````\n\n### Creating functions\n\n```python\n# Functions (or lambdas) take the form f(a1, a2, ..., an) -\u003e an+1\n\n# Constructor a 2D function f(x) -\u003e y\nfx = lambda x: x*x\n\n# Constructor a 3D function f(x,y) -\u003e z\nfxy = lambda x, y: (x-1)**2+(y-2)**2\n\n# Constructor a 4D function f(x,y,z) -\u003e d\nfxyz = lambda x, y, z: x**2+5*y+z\n```\n\n### Running\n\n```python\n# Starting point\nstart = [-2, -6]\n\n# Delta size (how far should we move towards our goal)\ndelta = 0.25\n\n# Number of steps\nsteps = 1000\n\n# Get a list of points for each step in the algorithm\npoints = gd.minimize(fxy, start, delta, steps)\n```\n\n### Printing\n\n```python\nprint(points)\n# points[0]   -\u003e [-2.0,    -6.0,     73.0      ]\n# points[1]   -\u003e [-1.83.., -5.82..,  69.21..   ]\n# ..\n# points[999] -\u003e [ 0.99..,  1.99..,  2.47..e-31]\n```\n\n### Plotting\n\n![f(x,y)=(x-1)^2+(y-2)^2](https://raw.github.com/joshdk/pygradesc/master/img/graph2.png \"f(x,y)=(x-1)^2+(y-2)^2\")\n\nDependencies\n------------\n\n*   [Python2](http://www.python.org/download/releases/2.7.3/)\n*   [NumPy](http://numpy.scipy.org/)\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdk%2Fpygradesc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshdk%2Fpygradesc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdk%2Fpygradesc/lists"}