{"id":31789841,"url":"https://github.com/brunos3d/perceptron-even-odd-classifier","last_synced_at":"2026-02-16T02:35:09.085Z","repository":{"id":297474138,"uuid":"996901001","full_name":"brunos3d/perceptron-even-odd-classifier","owner":"brunos3d","description":"Interactive visualization of a perceptron neural network that classifies numbers as even or odd using JavaScript and D3.js.","archived":false,"fork":false,"pushed_at":"2025-06-05T16:38:24.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-05T17:31:44.739Z","etag":null,"topics":["ai","bias","even","example","input","math","neural-network","neuron","odd","output","perceptron","sample","study","train"],"latest_commit_sha":null,"homepage":"https://brunos3d.github.io/perceptron-even-odd-classifier/","language":"HTML","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/brunos3d.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-05T16:28:37.000Z","updated_at":"2025-06-05T16:42:41.000Z","dependencies_parsed_at":"2025-06-05T17:32:27.467Z","dependency_job_id":"d9f71d74-4f15-40ac-a3bd-c6496f243a9f","html_url":"https://github.com/brunos3d/perceptron-even-odd-classifier","commit_stats":null,"previous_names":["brunos3d/perceptron-even-odd-classifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brunos3d/perceptron-even-odd-classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunos3d%2Fperceptron-even-odd-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunos3d%2Fperceptron-even-odd-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunos3d%2Fperceptron-even-odd-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunos3d%2Fperceptron-even-odd-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunos3d","download_url":"https://codeload.github.com/brunos3d/perceptron-even-odd-classifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunos3d%2Fperceptron-even-odd-classifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004578,"owners_count":26083735,"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-10-10T02:00:06.843Z","response_time":62,"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":["ai","bias","even","example","input","math","neural-network","neuron","odd","output","perceptron","sample","study","train"],"created_at":"2025-10-10T15:17:16.678Z","updated_at":"2025-10-10T15:17:18.420Z","avatar_url":"https://github.com/brunos3d.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Perceptron Visualizer: Even or Odd Classifier\n\nThis project is an interactive JavaScript visualization of a perceptron neural network that learns to classify numbers as **even or odd**. It provides a live, browser-based interface with visualization powered by D3.js.\n\n---\n\n## 🚀 Features\n\n- 🔍 Input a number and test if it's classified as even or odd\n- 🧠 Visual graph of the neural network structure (input → neuron → output)\n- ⚙️ Train automatically until reaching a target accuracy\n- ⏹️ Stop training at any time\n- 📊 Live display of weights, bias, epoch count, and accuracy\n\n---\n\n## 📚 How It Works\n\nThis project uses a **single-layer perceptron** — the simplest form of a neural network — to classify numbers.\n\n### 🧮 Perceptron Equation\n\nThe perceptron calculates the output `y` from input `x` using:\n\n```\ny = f(w * x + b)\n```\n\nWhere:\n- `x` is the input (in this case, `x = n % 2`)\n- `w` is the weight\n- `b` is the bias\n- `f(z)` is the activation function:\n  ```\n  f(z) = {\n    1, if z \u003e= 0.5\n    0, otherwise\n  }\n  ```\n\nThe output `y` will be:\n- `1` for odd numbers\n- `0` for even numbers\n\n### 🔁 Training Rule\n\nEach epoch updates weights using the perceptron learning rule:\n\n```\nerror = expected - predicted\nw = w + learningRate * error * x\nb = b + learningRate * error\n```\n\nThis update process is repeated until the accuracy reaches a user-defined threshold.\n\n---\n\n## 🎨 Visualization\n\nD3.js is used to render a simple visual of the perceptron network:\n- **Input Node**\n- **Single Neuron**\n- **Output Node**\n\nThese are connected with lines and display live updates of current weights and bias.\n\n---\n\n## 🧪 Usage\n\n1. Open `index.html` in your browser.\n2. Enter a minimum accuracy (default: 90%).\n3. Click **Train Perceptron**.\n4. The network will train until the desired accuracy is reached.\n5. Use **Test Number** to verify the classification of any integer.\n6. Click **Stop Training** to manually halt training.\n\n---\n\n## 🛠 Tech Stack\n\n- **HTML5**\n- **JavaScript (Vanilla)**\n- **D3.js v7**\n\nNo build tools or dependencies required — just open the HTML file in your browser.\n\n---\n\n## 🧠 Educational Purpose\n\nThis project is meant as a learning tool to demonstrate:\n- How perceptrons work\n- Binary classification\n- Live training feedback\n- Basic D3.js visualizations\n\n---\n\n## 📄 License\n\nMIT — Free to use, modify, and share.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunos3d%2Fperceptron-even-odd-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunos3d%2Fperceptron-even-odd-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunos3d%2Fperceptron-even-odd-classifier/lists"}