{"id":16829345,"url":"https://github.com/montanaflynn/simple-go-perceptron","last_synced_at":"2025-04-11T04:03:41.878Z","repository":{"id":139507975,"uuid":"167478133","full_name":"montanaflynn/simple-go-perceptron","owner":"montanaflynn","description":"A simple perceptron in Golang","archived":false,"fork":false,"pushed_at":"2019-01-25T03:22:33.000Z","size":2,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T04:03:36.479Z","etag":null,"topics":["learning-algorithm","machine-learning","perceptron"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/montanaflynn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-25T03:22:21.000Z","updated_at":"2024-08-03T12:44:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"f181820e-6887-47cc-91b6-dfce30365976","html_url":"https://github.com/montanaflynn/simple-go-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/montanaflynn%2Fsimple-go-perceptron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fsimple-go-perceptron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fsimple-go-perceptron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fsimple-go-perceptron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/montanaflynn","download_url":"https://codeload.github.com/montanaflynn/simple-go-perceptron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339285,"owners_count":21087215,"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":["learning-algorithm","machine-learning","perceptron"],"created_at":"2024-10-13T11:32:46.935Z","updated_at":"2025-04-11T04:03:41.871Z","avatar_url":"https://github.com/montanaflynn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Perceptron\n\nThe simplest [Perceptron](https://en.wikipedia.org/wiki/Perceptron) you'll ever see.\n\nPorted directly from https://github.com/victorqribeiro/perceptron in JavaScript.\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```\nvar x = [][]float64{\n\t{180.0, 80.0},\n\t{175.0, 67.0},\n\t{100.0, 30.0},\n\t{120.0, 32.0},\n}\n\nvar y = []int{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```\np := perceptron.New(len(x[0]), 0.2, 100)\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(float64{178.0, 70.0})\n```\n\nSuper simple.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontanaflynn%2Fsimple-go-perceptron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmontanaflynn%2Fsimple-go-perceptron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontanaflynn%2Fsimple-go-perceptron/lists"}