{"id":27441318,"url":"https://github.com/qrexpy/neuralpy","last_synced_at":"2025-04-14T23:46:32.436Z","repository":{"id":285958636,"uuid":"959842554","full_name":"qrexpy/neuralpy","owner":"qrexpy","description":"A neural network implementation built from scratch in Python","archived":false,"fork":false,"pushed_at":"2025-04-04T12:57:12.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T23:46:29.045Z","etag":null,"topics":[],"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/qrexpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-04-03T12:49:19.000Z","updated_at":"2025-04-04T12:57:16.000Z","dependencies_parsed_at":"2025-04-03T15:37:50.192Z","dependency_job_id":"e6c9a69b-8cf1-4b34-8888-064d7828d697","html_url":"https://github.com/qrexpy/neuralpy","commit_stats":null,"previous_names":["qrexpy/neuralpy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrexpy%2Fneuralpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrexpy%2Fneuralpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrexpy%2Fneuralpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qrexpy%2Fneuralpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qrexpy","download_url":"https://codeload.github.com/qrexpy/neuralpy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981258,"owners_count":21193143,"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":"2025-04-14T23:46:31.689Z","updated_at":"2025-04-14T23:46:32.406Z","avatar_url":"https://github.com/qrexpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neural.py\n\nA neural network implementation built entirely from scratch in Python, with no dependencies on deep learning frameworks. This project demonstrates the fundamental principles of neural networks by implementing all mathematical operations and algorithms manually.\n\n## Features\n\n- **Pure Python Implementation**: All mathematical operations implemented from scratch\n- **Multiple Activation Functions**: Sigmoid, ReLU, and Leaky ReLU\n- **Custom Matrix Operations**: Efficient matrix multiplication, addition, and more\n- **Mathematical Functions**: Taylor series for exponential, Newton's method for square root\n- **Random Number Generation**: Linear congruential generator\n- **Visualization Tools**: Network architecture, training progress, and more\n- **Comprehensive Tests**: XOR problem and digit recognition examples\n- **Interactive Examples**: Real-world applications including a learning Tic Tac Toe agent\n\n\u003e [!NOTE]\n\u003e The NumPy implementation (`neural.py`) is 15-100x faster than the pure Python implementation (`pure_neural.py`) according to benchmark tests. The pure implementation is provided for educational purposes to understand the underlying mathematics.\n\n## Installation\n\n```bash\ngit clone https://github.com/qrexpy/neuralpy.git\ncd neural.py\npip install -r requirements.txt\n```\n\n## Usage\n\n```python\nfrom src.pure_neural import PureNeuralNetwork\n\n# Create a neural network with 2 input neurons, 4 hidden neurons, and 1 output neuron\nnn = PureNeuralNetwork([2, 4, 1], learning_rate=0.1)\n\n# Train the network\nX = [[0, 0], [0, 1], [1, 0], [1, 1]]  # Input data\ny = [[0], [1], [1], [0]]              # Target data\nlosses = nn.train(X, y, epochs=10000)\n\n# Make predictions\npredictions = nn.predict(X)\n```\n\n## Project Structure\n\n```\n.\n├── src/\n│   ├── neural.py         # Main neural network implementation\n│   ├── pure_neural.py    # Pure implementation without NumPy\n│   ├── math_ops.py       # Mathematical operations from scratch\n│   └── visualization.py  # Visualization tools\n├── tests/\n│   ├── test_neural_network.py  # Tests for NumPy implementation\n│   └── test_pure_neural.py     # Tests for pure implementation\n├── examples/\n│   ├── tic_tac_toe/      # Tic Tac Toe game with reinforcement learning\n│   └── run_examples.py   # Script to run all examples\n├── requirements.txt\n└── README.md\n```\n\n## Testing\n\nRun the interactive test suite to choose which models and tests to run:\n\n```bash\npython tests/run_tests.py\n```\n\nThis will present you with a menu to:\n- Choose which models to test (Pure Python, NumPy, or both)\n- Select which tests to run (XOR, Digit Recognition, or both)\n- Configure test parameters (samples, epochs, batch size)\n\nOr run specific test files directly:\n\n```bash\npython tests/test_neural_network.py  # Test NumPy implementation\npython tests/test_pure_neural.py     # Test pure implementation\n```\n\n## Examples\n\nThe project includes interactive examples that demonstrate the neural network in practical applications.\n\nFor detailed documentation about the examples and how to use them, see [EXAMPLES.md](EXAMPLES.md).\n\nRun any example using the examples runner:\n\n```bash\npython examples/run_examples.py\n```\n\nOr run a specific example directly:\n\n```bash\npython examples/tic_tac_toe/game.py\n```\n\n## Parameters\n\n- `layer_sizes`: List of integers representing the number of neurons in each layer\n- `learning_rate`: Learning rate for gradient descent (default: 0.1)\n- `use_relu`: Whether to use ReLU activation function (default: False)\n- `use_leaky_relu`: Whether to use Leaky ReLU activation function (default: False)\n- `leaky_relu_alpha`: Alpha parameter for Leaky ReLU (default: 0.01)\n\n## License\n\nMIT ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqrexpy%2Fneuralpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqrexpy%2Fneuralpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqrexpy%2Fneuralpy/lists"}