{"id":20532512,"url":"https://github.com/joshdk/pyceptron","last_synced_at":"2025-03-06T02:49:11.903Z","repository":{"id":4635894,"uuid":"5780539","full_name":"joshdk/pyceptron","owner":"joshdk","description":"An n-dimensional hyperplanar perceptron, written in Python","archived":false,"fork":false,"pushed_at":"2012-10-14T22:46:02.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T13:17:30.655Z","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":null,"license":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-12T13:56:41.000Z","updated_at":"2014-02-25T17:45:14.000Z","dependencies_parsed_at":"2022-09-16T16:00:17.701Z","dependency_job_id":null,"html_url":"https://github.com/joshdk/pyceptron","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpyceptron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpyceptron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpyceptron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fpyceptron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshdk","download_url":"https://codeload.github.com/joshdk/pyceptron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242138805,"owners_count":20078007,"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-16T00:15:18.000Z","updated_at":"2025-03-06T02:49:11.867Z","avatar_url":"https://github.com/joshdk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pyceptron\n=========\n\nAn n-dimensional hyperplanar perceptron\n\nUsage\n-----\n\n### Importing\n\n```python\nfrom pyceptron import Pyceptron\n````\n\n### Constructing\n\n```python\n# Constructor assumes 2 dimensions\ntron = Pyceptron()\n\n# Or, if you want a perceptron in some other dimension\ntron = Pyceptron(4)\n```\n\n### Creating points\n\n```python\n# Each data point is a combination of an n-dimensional array, and a classification (-1 or 1)\n\n# 2-dimensional data\npoints1d = [\n\t([0.25],  1),\n\t([0.50],  1),\n\t([1.00], -1),\n\t([1.25], -1)\n]\n\n# 2-dimensional data\npoints2d = [\n\t([0, 3],  1),\n\t([1, 2],  1),\n\t([2, 1], -1),\n\t([3, 0], -1)\n]\n\n# 3-dimensional data\npoints3d = [\n\t([1,  2,  3],  1),\n\t([2,  4,  6],  1),\n\t([4,  8, 12), -1),\n\t([8, 16, 24), -1)\n]\n```\n\n### Populating\n\n```python\ntron.populate(points2d)\n```\n\n### Training\n\n```python\n# By default, the algorithm rill run until it finds a solution\ntron.train()\n\n# Or, you can give it a max number of steps\nif tron.train(100) != True:\n\tprint('No solution was found in 100 iterations...')\nelse:\n\tprint('A solution was found!')\n\n# Of course, you can keep training without losing state\nif tron.train(100) != True:\n\tprint('No solution was found in 100 iterations...')\n\tif tron.train(50) != True:\n\t\tprint('No solution was found in 150 iterations...')\n\telse:\n\t\tprint('A solution was found within 150 iterations!')\nelse:\n\tprint('A solution was found within 100 iterations!')\n```\n\n### Weights\n\n``` python\n\t# Getting weights\n\tweights = tron.weights()\n\n\t# Setting weights\n\t# Note - For n-dimensional data points, you have n+1 weights\n\ttron.weights([12, 33, 56])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdk%2Fpyceptron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshdk%2Fpyceptron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdk%2Fpyceptron/lists"}