{"id":31044871,"url":"https://github.com/klus3kk/fit","last_synced_at":"2025-09-14T16:52:40.003Z","repository":{"id":291850771,"uuid":"966890533","full_name":"Klus3kk/fit","owner":"Klus3kk","description":"A machine learning framework built from scratch in Python. ","archived":false,"fork":false,"pushed_at":"2025-08-09T21:19:59.000Z","size":385,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-08T01:47:28.350Z","etag":null,"topics":["in-progress","machine-learning","ml-framework","python"],"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/Klus3kk.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-04-15T15:54:16.000Z","updated_at":"2025-08-09T21:20:03.000Z","dependencies_parsed_at":"2025-05-06T21:34:23.931Z","dependency_job_id":"56b76736-c74d-45dd-b5ea-b99b43234920","html_url":"https://github.com/Klus3kk/fit","commit_stats":null,"previous_names":["klus3kk/fit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Klus3kk/fit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Klus3kk%2Ffit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Klus3kk%2Ffit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Klus3kk%2Ffit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Klus3kk%2Ffit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Klus3kk","download_url":"https://codeload.github.com/Klus3kk/fit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Klus3kk%2Ffit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275136722,"owners_count":25411709,"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-09-14T02:00:10.474Z","response_time":75,"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":["in-progress","machine-learning","ml-framework","python"],"created_at":"2025-09-14T16:52:35.919Z","updated_at":"2025-09-14T16:52:39.990Z","avatar_url":"https://github.com/Klus3kk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FIT\nA PyTorch-like machine learning library built from scratch with NumPy. Train neural networks with automatic differentiation, no dependencies beyond NumPy.\n\n[Documentation](https://fit-ml.readthedocs.io/) (for now it's incomplete, will finish it soon c:) | [Examples](examples/)\n\n## Why FIT?\n\n- **Lightweight**: Only requires NumPy\n- **Educational**: Understand ML from first principles\n- **Familiar API**: PyTorch-like interface\n- **Production ready**: Type hints, logging, proper error handling\n\n## Installation\n\n```bash\npip install git+https://github.com/Klus3kk/fit.git\n```\n\n## Example\n\nSolve XOR problem:\n\n```python\nfrom fit.core.tensor import Tensor\nfrom fit.nn.modules.container import Sequential\nfrom fit.nn.modules.linear import Linear\nfrom fit.nn.modules.activation import ReLU\nfrom fit.loss.regression import MSELoss\nfrom fit.optim.adam import Adam\n\n# XOR dataset\nX = Tensor([[0, 0], [0, 1], [1, 0], [1, 1]])\ny = Tensor([[0], [1], [1], [0]])\n\n# Model\nmodel = Sequential(\n    Linear(2, 8),\n    ReLU(),\n    Linear(8, 1)\n)\n\n# Training\nloss_fn = MSELoss()\noptimizer = Adam(model.parameters(), lr=0.01)\n\nfor epoch in range(1000):\n    pred = model(X)\n    loss = loss_fn(pred, y)\n    \n    optimizer.zero_grad()\n    loss.backward()\n    optimizer.step()\n    \n    if epoch % 200 == 0:\n        print(f\"Loss: {loss.data:.4f}\")\n\n# Test\nprint(f\"Predictions: {model(X).data}\")\n```\n\n## What's included\n\n**Core**: Tensors with autograd, just like PyTorch\n```python\nx = Tensor([1, 2, 3], requires_grad=True)\ny = x.sum()\ny.backward()  # x.grad is now [1, 1, 1]\n```\n\n**Layers**: Linear, activations, normalization, attention\n```python\nfrom fit.nn.modules.activation import ReLU, GELU\nfrom fit.nn.modules.normalization import BatchNorm1d\n```\n\n**Optimizers**: SGD, Adam, and advanced ones like SAM\n```python\nfrom fit.optim.adam import Adam\nfrom fit.optim.experimental.sam import SAM\n```\n\n**Simple API**: For quick experiments\n```python\nfrom fit.simple.models import Classifier\nmodel = Classifier(input_size=784, num_classes=10)\n```\n\n## MNIST example\n\n```python\nimport numpy as np\nfrom fit.core.tensor import Tensor\nfrom fit.nn.modules.container import Sequential\nfrom fit.nn.modules.linear import Linear\nfrom fit.nn.modules.activation import ReLU\nfrom fit.optim.adam import Adam\nfrom fit.loss.classification import CrossEntropyLoss\n\n# Create MNIST classifier \nmodel = Sequential(\n    Linear(784, 128),\n    ReLU(),\n    Linear(128, 64), \n    ReLU(),\n    Linear(64, 10)\n)\n\n# Generate some dummy data \nX_train = Tensor(np.random.randn(100, 784))\ny_train = Tensor(np.random.randint(0, 10, (100,)))\n\noptimizer = Adam(model.parameters(), lr=0.001)\nloss_fn = CrossEntropyLoss()\n\n# Training loop\nfor epoch in range(50):\n    pred = model(X_train)\n    loss = loss_fn(pred, y_train)\n    \n    optimizer.zero_grad()\n    loss.backward()\n    optimizer.step()\n    \n    if epoch % 10 == 0:\n        print(f\"Epoch {epoch}, Loss: {loss.data:.4f}\")\n```\n\nPerfect for learning how neural networks work under the hood, or when you need a lightweight ML library without the complexity of PyTorch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklus3kk%2Ffit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklus3kk%2Ffit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklus3kk%2Ffit/lists"}