{"id":13426234,"url":"https://github.com/victorqribeiro/perceptron","last_synced_at":"2025-05-05T19:44:25.651Z","repository":{"id":128647118,"uuid":"167429023","full_name":"victorqribeiro/perceptron","owner":"victorqribeiro","description":"The simplest Perceptron you'll ever see","archived":false,"fork":false,"pushed_at":"2019-02-10T00:34:00.000Z","size":126,"stargazers_count":47,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T23:11:12.285Z","etag":null,"topics":["machine-learning","machine-learning-algorithms","perceptron"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/victorqribeiro.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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-01-24T20:02:34.000Z","updated_at":"2025-03-18T08:05:35.000Z","dependencies_parsed_at":"2023-04-15T20:56:59.047Z","dependency_job_id":null,"html_url":"https://github.com/victorqribeiro/perceptron","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/victorqribeiro%2Fperceptron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorqribeiro%2Fperceptron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorqribeiro%2Fperceptron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorqribeiro%2Fperceptron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorqribeiro","download_url":"https://codeload.github.com/victorqribeiro/perceptron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252564168,"owners_count":21768603,"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":["machine-learning","machine-learning-algorithms","perceptron"],"created_at":"2024-07-31T00:01:29.654Z","updated_at":"2025-05-05T19:44:25.613Z","avatar_url":"https://github.com/victorqribeiro.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Perceptron\n\nThe simplest [Perceptron](https://en.wikipedia.org/wiki/Perceptron) you'll ever see.\n\n## How to use\n\nLet's suppose you have the following data set:\n\n| Height (cm) | Weight (kg) | Class (0-1) |\n|-------------|-------------|-------------|\n| 180         | 80          | 0           |\n| 175         | 67          | 0           |\n| 100         | 30          | 1           |\n| 120         | 32          | 1           |\n\n0 - adult  \n1 - child\n\nYou need to process the table to this format:\n\n```\nconst x = [\n\t[180, 80],\n\t[175, 67],\n\t[100, 30],\n\t[120, 32]\n];\n\nconst y = [0,0,1,1];\n```\n\nThen just create a new Perceptron passing the shape of the data (height and weight), the learning rate and the number of iterations. By default the learning rate is set to 0.01 and the number of iterations is set to 10.\n\n```\nconst p = new Perceptron( x[0].length );\n```\n\nCall the fit function\n\n```\np.fit(x,y);\n```\n\nAnd you're all set to make predictions\n\n```\np.predict([178, 70])\n```\n\nSuper simple.\n\n# Applications\n\n[Can a simple perceptron drive a car in a game?](https://github.com/victorqribeiro/carGamePerceptron)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorqribeiro%2Fperceptron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorqribeiro%2Fperceptron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorqribeiro%2Fperceptron/lists"}