{"id":18687737,"url":"https://github.com/marcos-venicius/smlf","last_synced_at":"2025-04-12T05:28:24.906Z","repository":{"id":212112451,"uuid":"730740528","full_name":"marcos-venicius/smlf","owner":"marcos-venicius","description":"A small machine learning framework with ONLY python and math","archived":false,"fork":false,"pushed_at":"2023-12-13T22:39:09.000Z","size":9,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T00:51:19.923Z","etag":null,"topics":["artificial-intelligence","deep-learning","ia","machine-learning","ml","models","neural-network","xor"],"latest_commit_sha":null,"homepage":"","language":"Python","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-12T15:14:19.000Z","updated_at":"2023-12-14T10:22:26.000Z","dependencies_parsed_at":"2024-11-07T10:49:11.199Z","dependency_job_id":null,"html_url":"https://github.com/marcos-venicius/smlf","commit_stats":null,"previous_names":["marcos-venicius/smlf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2Fsmlf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2Fsmlf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2Fsmlf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-venicius%2Fsmlf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcos-venicius","download_url":"https://codeload.github.com/marcos-venicius/smlf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248521812,"owners_count":21118161,"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":["artificial-intelligence","deep-learning","ia","machine-learning","ml","models","neural-network","xor"],"created_at":"2024-11-07T10:33:57.624Z","updated_at":"2025-04-12T05:28:24.877Z","avatar_url":"https://github.com/marcos-venicius.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMLF\n\n**Small Machine Learning Framework**\n\nThis is a small framework to machine learning models.\n\nWe have a class `Matrix` and a class `NeuralNetwork`.\n\n# Examples\n\n## Xor\n\n[view the file](./examples/xor.py)\n\n```console\ncd examples\n\npython3 xor.py\n```\n\nOutput example:\n\n![Screenshot from 2023-12-12 11-59-20](https://github.com/marcos-venicius/smlf/assets/94018427/06b8fc84-84ec-4ffd-9270-42a47b195b73)\n\n# Docs\n\n## Matrix docs\n\nIf you wanna print the `Matrix`:\n\n```py\nm = Matrix(2, 2)\n\nprint(m)\n```\n\nIf you wanna randomize the `Matrix`:\n\n```py\nrand(self) -\u003e None\n```\n\nIf you wanna fill the `Matrix` with just one value:\n\n```py\nfill(self, x: float) -\u003e None\n```\n\nIf you wanna initialize with specific values:\n\n```py\nm1 = Matrix(2, 2, [[0, 1], [0, 1]]) # \u003c-- use the multidimensional array as the third parameter\n```\n\nIf you wanna set a specific value to a specific location:\n\n```py\nset(self, row: int, col: int, x: float) -\u003e None\n```\n\nIf you wanna sum the `Matrix` with another:\n\n```py\nm1 = Matrix(2, 2)\nm1.rand()\n\nm2 = Matrix(2, 2)\nm2.rand()\n\nm3 = m1.sum(m2) # \u003c-- do this\n```\n\nIf you wanna apply the sigmoid activation function:\n\n```py\napply_sigmoid(self) -\u003e None\n```\n\nIf you wanna get a row:\n\n```py\nrow(row: int) -\u003e Matrix\n```\n\nIf you wanna get a value a specifc row and column:\n\n```py\nat(r: int, c: int) -\u003e float\n```\n\nIf you wanna multiply the `Matrix` by another:\n\n```py\nm1 = Matrix(2, 2)\nm2 = Matrix(2, 2)\n\nm1.rand()\nm2.rand()\n\nm3 = m1.dot(m2) # \u003c-- do this\n```\n\n## NeuralNetwork docs\n\nThe neural network expects an architecture like `[2, 2, 1]`, that means:\n\n* 2 inputs\n* 1 hidden layer\n* 1 output\n\nIf you wanna print the `NeuralNetwork`:\n\n```py\nnn = NeuralNetwork([2, 2, 1])\n\nprint(nn) # \u003c-- do this\n```\n\nIf you wanna get the `NeuralNetwork` input:\n\n```py\ninput(self) -\u003e Matrix\n```\n\nIf you wanna get the `NeuralNetwork` output:\n\n```py\noutput(self) -\u003e Matrix\n```\n\nIf you wanna set the input mannually:\n\n```py\nset_input(self, input: Matrix) -\u003e None\n```\n\nIf you wanna randomize the Neural Network (between 0 and 1):\n\n```py\nrand(self) -\u003e None\n```\n\nIf you wanna forward:\n\n```py\nforward(self) -\u003e None\n```\n\nIf you wanna calculate the cost:\n\n```py\ncost(self, train_input: Matrix, train_output: Matrix) -\u003e float\n```\n\nIf you wanna do a finite diff manually (it's made internally):\n\n```py\nfinite_diff(self, g: NeuralNetwork, epsilon: float, train_input: Matrix, train_output: Matrix) -\u003e None\n```\n\nIf you wanna make the model learn manually (it's made internally):\n\n```py\nlearn(self, g: NeuralNetwork, learning_rate: float) -\u003e None\n```\n\nIf you wanna train the model:\n\n```py\ntrain(self, g: NeuralNetwork, learning_rate: float, epsilon: float, train_input: Matrix, train_output: Matrix, epochs: int) -\u003e None\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcos-venicius%2Fsmlf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcos-venicius%2Fsmlf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcos-venicius%2Fsmlf/lists"}