{"id":21169772,"url":"https://github.com/andreasgrv/decision_boundary_demo","last_synced_at":"2025-07-09T19:32:02.158Z","repository":{"id":37591648,"uuid":"184538474","full_name":"andreasgrv/decision_boundary_demo","owner":"andreasgrv","description":"Matplotlib visualisation of decision boundaries for neural networks","archived":false,"fork":false,"pushed_at":"2022-06-21T21:55:53.000Z","size":8,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-02T14:41:55.868Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreasgrv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-02T07:24:24.000Z","updated_at":"2020-09-23T18:02:30.000Z","dependencies_parsed_at":"2022-09-07T08:12:09.279Z","dependency_job_id":null,"html_url":"https://github.com/andreasgrv/decision_boundary_demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fdecision_boundary_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fdecision_boundary_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fdecision_boundary_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fdecision_boundary_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreasgrv","download_url":"https://codeload.github.com/andreasgrv/decision_boundary_demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225587805,"owners_count":17492632,"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-20T15:53:38.721Z","updated_at":"2024-11-20T15:53:39.363Z","avatar_url":"https://github.com/andreasgrv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Neural network decision boundary visualisation\n\nThis is a naive demo of multi-class and multi-label classification.\nThe demo allows you to alter the weights of 3 classifiers, one for each class (blueberries, bananas, strawberries).\nThe weights vectors are visualised using arrows, and the decision boundaries by using lines.\nMoving the weight vectors around, changes the decision boundaries.\nIt also changes the probability of each input point belonging to one of the three classes, as visualised on the 3d plot on the right.\n\n\n## How to move things\n\nThe 3d plot can be moved around and the 2d plot can be zoomed in/out by scrolling.\nChoose which class you want to change the weight vector for from the radio buttons and click on the left plot to change its weights.\nYou can also alter the bias term for each class by clicking on the bars at the top right.\n\nIf sigmoids is chosen, then this is interpreted as a multi-label classification setting and there is an independent binary classifier fit for each class.\nIn this case therefore, there is a separate probability for each class being true, and we can visualise these three probabilities as\na (x, y, z) point constrained to be in the unit cube (as seen below on the right).\n\n![Decision boundary with intersecting lines and sigmoids](http://grv.overfit.xyz/static/images/lines.jpg)\n\nIf softmax is chosen, then classes are mutually exclusive (the score for each class is normalized to form a probability distribution over all classes).\nTherefore, the probability of each class for each input point is constrained to be a (x, y, z) point on the 2-simplex (as seen below).\n![Decision boundary with intersecting lines and softmax](http://grv.overfit.xyz/static/images/softmax.jpg)\n\nIf we also choose circle from the first radio button, we augment the input using basis functions so that we get circular decision boundaries.\n![Decision boundary with intersecting circles and sigmoids](http://grv.overfit.xyz/static/images/circles.jpg)\n\n\n### Requirements\n\n* Python3.7 (should work on older python3)\n* matplotlib\n* numpy\n\n\n### How to run\n\n``` bash\ngit clone https://github.com/andreasgrv/decision_boundary_demo\ncd decision_boundary_demo\npython3.7 -m venv .env \u0026\u0026 source .env/bin/activate\npip install -r requirements.txt\npython main.py\n```\n\n### Options\n\n* Linear or circular decision boundaries\n* Choose weights and biases\n* Sigmoids or softmax\n\n\n### Notes\n\n* For softmax the decision boundaries are formed by the differences of weight vectors, that is not currently mirrored in the lines but should be mirrored in the colours of the points.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasgrv%2Fdecision_boundary_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreasgrv%2Fdecision_boundary_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasgrv%2Fdecision_boundary_demo/lists"}