{"id":30232199,"url":"https://github.com/param302/scratchnet","last_synced_at":"2025-08-14T23:38:47.745Z","repository":{"id":300980040,"uuid":"1007636798","full_name":"Param302/ScratchNet","owner":"Param302","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-25T10:44:35.000Z","size":426,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-25T11:19:12.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/Param302.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-24T09:48:52.000Z","updated_at":"2025-06-25T10:44:39.000Z","dependencies_parsed_at":"2025-06-25T11:19:13.489Z","dependency_job_id":null,"html_url":"https://github.com/Param302/ScratchNet","commit_stats":null,"previous_names":["param302/scratchnet-app","param302/scratchnet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Param302/ScratchNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Param302%2FScratchNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Param302%2FScratchNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Param302%2FScratchNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Param302%2FScratchNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Param302","download_url":"https://codeload.github.com/Param302/ScratchNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Param302%2FScratchNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270500368,"owners_count":24595156,"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-08-14T02:00:10.309Z","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":[],"created_at":"2025-08-14T23:38:43.255Z","updated_at":"2025-08-14T23:38:47.738Z","avatar_url":"https://github.com/Param302.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [ScratchNet 🔗](https://scratchnet.streamlit.app)\n\n## Overview\n\nScratchNet is a demonstration of building and training **Artificial Neural Networks** (ANNs) _from scratch in Python using only NumPy_ - no deep learning frameworks. The models are trained on classic datasets and this app showcases their performance and predictions interactively.\n\nhttps://github.com/user-attachments/assets/c3f424a5-e140-444a-9551-38e12f93ff7e\n\n---\n\n## Datasets\n\n### Breast Cancer (Binary Classification)\nClassifies tumors as benign or malignant using 30 features from digitized images of fine needle aspirate (FNA) of breast mass.  \n**Target labels:** Benign (0), Malignant (1).  \n**Dataset:** scikit-learn's Breast Cancer Wisconsin.\n\n### California Housing (Regression)\nPredicts the median house value in a California block group using 8 features such as median income, house age, average rooms, and location.  \n**Target label:** MedHouseVal (Median House Value).  \n**Dataset:** scikit-learn's California Housing.\n\n### Iris Flower Species (Multiclass Classification)\nPredicts the species of an iris flower using four features: sepal length, sepal width, petal length, and petal width.  \n**Target labels:** Setosa, Versicolor, Virginica.  \n**Dataset:** scikit-learn's Iris.\n\n---\n\n## Models\n\n### Model Architecture\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBreast Cancer\u003c/strong\u003e\u003c/summary\u003e\n\n- 4 layers:  \n  - Input: 30 features  \n  - Hidden: 30, 60, 15 neurons  \n  - Output: 1 (Sigmoid)\n- Activations: ReLU, Sigmoid  \n- Loss: Binary Cross Entropy  \n- Accuracy: 89%  \n[View Model Code](models/code/ANN_Breast_cancer.py)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eCalifornia Housing\u003c/strong\u003e\u003c/summary\u003e\n\n- 5 layers:  \n  - Input: 8 features  \n  - Hidden: 10, 16, 32, 16 neurons  \n  - Output: 1 (Linear)\n- Activations: ReLU, Linear  \n- Loss: MSE  \n[View Model Code](models/code/ANN_California_housing.py)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eIris\u003c/strong\u003e\u003c/summary\u003e\n\n- 5 layers:  \n  - Input: 4 features  \n  - Hidden: 8, 16, 64, 10 neurons  \n  - Output: 3 (Softmax)\n- Activations: ReLU, Softmax  \n- Loss: Sparse Categorical Cross Entropy  \n- Accuracy: 97%  \n[View Model Code](models/code/ANN_iris.py)\n\u003c/details\u003e\n\n---\n\n### Neural Network Module\n\nThe neural network, dense layers, loss, and activation functions are implemented from scratch in the [`NN/`](https://github.com/Param302/ScratchNet/tree/main/NN) directory:\n- [`network.py`](https://github.com/Param302/ScratchNet/blob/main/NN/network.py): Neural network class, training loop, prediction, summary, save/load.\n- [`layers.py`](https://github.com/Param302/ScratchNet/blob/main/NN/layers.py): Dense layer implementation.\n- [`activations.py`](https://github.com/Param302/ScratchNet/blob/main/NN/activations.py): ReLU, Sigmoid, Softmax, Linear, Tanh.\n- [`loss.py`](https://github.com/Param302/ScratchNet/blob/main/NN/loss.py): MSE, Binary Cross Entropy, Sparse Categorical Cross Entropy.\n\n[View NN Module](NN/)\n\n---\n\n### Model Notebook\n\nAll model development, training, and analysis are documented in  \n[ANN_from_Scratch.ipynb](ANN_from_Scratch.ipynb).\n\n---\n\n## Steps to Run\n\nRequires:\n- **Python** 3.10.16\n- **Streamlit** 1.46.0\n\n1. **Clone the repository**\n   ```\n   git clone https://github.com/Param302/ScratchNet.git\n   cd ScratchNet\n   ```\n\n2. **Create a virtual environment**\n\n   - **Windows**\n     ```\n     python -m venv venv\n     venv\\Scripts\\activate\n     ```\n   - **Linux/Mac**\n     ```\n     python3 -m venv venv\n     source venv/bin/activate\n     ```\n\n3. **Install requirements**\n   ```\n   pip install -r requirements.txt\n   ```\n\n4. **Run the Streamlit app**\n   ```\n   streamlit run app/main.py\n   ```\n\n   **OR**\n\n   **Run each model script directly** to train the model\n   ```\n   python models/code/ANN_Breast_cancer.py\n   python models/code/ANN_California_housing.py\n   python models/code/ANN_iris.py\n   ```\n\n---\n\n## Contact\n\nFor any questions or contributions, feel free to reach out:  \n[**Parampreet Singh**](https://parampreetsingh.me) \nEmail: [connectwithparam.30@gmail.com](mailto:connectwithparam.30@gmail.com)\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparam302%2Fscratchnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparam302%2Fscratchnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparam302%2Fscratchnet/lists"}