{"id":18687736,"url":"https://github.com/marcos-venicius/ml-hello-world","last_synced_at":"2025-04-12T05:29:24.582Z","repository":{"id":211330690,"uuid":"728846648","full_name":"marcos-venicius/ML-hello-world","owner":"marcos-venicius","description":"A hello world in Machine learning with a small ML framework with methods like \"mat_dot\", \"mat_sum\", \"mat_alloc\", ...","archived":false,"fork":false,"pushed_at":"2023-12-11T11:34:16.000Z","size":26,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T00:51:23.585Z","etag":null,"topics":["deep-learning","framework","ia","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"C","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/marcos-venicius.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}},"created_at":"2023-12-07T20:30:43.000Z","updated_at":"2024-07-16T18:27:33.000Z","dependencies_parsed_at":"2023-12-07T21:30:20.333Z","dependency_job_id":"0ceab91a-d801-47f4-8f4d-f4c1ddf0359c","html_url":"https://github.com/marcos-venicius/ML-hello-world","commit_stats":null,"previous_names":["marcos-venicius/ml-hello-world"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2FML-hello-world","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2FML-hello-world/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2FML-hello-world/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2FML-hello-world/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcos-venicius","download_url":"https://codeload.github.com/marcos-venicius/ML-hello-world/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248522627,"owners_count":21118342,"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":["deep-learning","framework","ia","machine-learning"],"created_at":"2024-11-07T10:33:57.560Z","updated_at":"2025-04-12T05:29:24.556Z","avatar_url":"https://github.com/marcos-venicius.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ML hello world\n\n**Notice this code is only to educational purposes, do not use it to any type of production ready application**\n\n\n## Explanation\n\n```math\na_1 = x_1 \\cdot w_{11} + x_2 \\cdot w_{12} + b_1\n```\n```math\na_2 = x_1 \\cdot w_{21} + x_2 \\cdot w_{22} + b_2\n```\n\nThe activation from the first layer:\n\n```math\n\\sigma\n\\begin{pmatrix}\n  \\begin{bmatrix}\n    x_{11} \u0026 x_{12}\n  \\end{bmatrix}\n\n  \\cdot\n\n  \\begin{bmatrix}\n    w_{11} \u0026 w_{12}\n    \\\\\n    w_{21} \u0026 w_{22}\n  \\end{bmatrix}\n\n  +\n\n  \\begin{bmatrix}\n    b_{11} \u0026 b_{12}\n  \\end{bmatrix}\n\\end{pmatrix}\n=\n\\begin{bmatrix}\n  a_{11} \u0026 a_{12}\n\\end{bmatrix}\n```\n\nThe activation to the second layer:\n\n```math\n\\sigma\n\\begin{pmatrix}\n  \\begin{bmatrix}\n    a_{11} \u0026 a_{12}\n  \\end{bmatrix}\n\n  \\cdot\n\n  \\begin{bmatrix}\n    w_{11}\n    \\\\\n    w_{12}\n  \\end{bmatrix}\n\n  +\n\n  \\begin{bmatrix}\n    b_{11}\n  \\end{bmatrix}\n\\end{pmatrix}\n=\ny\n```\n**we can only multiply matrices if the number of columns of the first matrix is equal to the number of rows of the second matrix.**\n\nThe `main.c` file has a basic ML algorithm that can learn `OR`, `AND` and `NAND` operations.\n\nThis algorithms is not capable to learn `XOR` because `XOR` cannot be linearly separated.\n\nSo, to do this job, we need more neurons.\n\nSo, the `deep-learning.c` file has a \"more complex\" ML algorithm with 3 neurons and 9 parameters that can handle `OR`, `AND`, `NAND` and `XOR`.\n\nWe also have the `dynamic-deep-learning.c`, that is a \"improved\" neural network that you can change the number of neurons dynamically by changing `NUMBER_OF_NEURONS`.\n\nAnother improvement is that in `dynamic-deep-learning.c` we don't need to `forward` the neural network mannualy, we do this by iteration over the network.\n\n## How to run?\n\nRunning `main.c`:\n\n```shell\ngcc main.c -lm -o main \u0026\u0026 ./main\n```\n\nOutput demonstration:\n\n![image](https://github.com/marcos-venicius/ML-hello-world/assets/94018427/5d0aef19-9439-4717-9147-9aea26b308c2)\n\nRunning `deep-learning.c`:\n\n```shell\ngcc deep-learning.c -lm -o deep-learning \u0026\u0026 ./deep-learning\n```\n\nOutput demonstration:\n\n![image](https://github.com/marcos-venicius/ML-hello-world/assets/94018427/80b88e85-910c-4c4f-bfbe-528f66eb1776)\n\nRunning `dynamic-deep-learning.c`:\n\n```shell\ngcc dynamic-deep-learning.c -lm -o dynamic-deep-learning \u0026\u0026 ./dynamic-deep-learning\n```\n\nOutput demonstration:\n\n![image](https://github.com/marcos-venicius/ML-hello-world/assets/94018427/5cbb37f5-9b5f-4eaa-ac1a-cb9c8576c3ca)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcos-venicius%2Fml-hello-world","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcos-venicius%2Fml-hello-world","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcos-venicius%2Fml-hello-world/lists"}