Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.1%) to scientific vocabulary
Keywords
Repository
nnetflow framework
Basic Info
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
nnetflow
A minimal neural network framework with autodiff, inspired by micrograd and pytorch.
Installation
bash
pip install nnetflow
```bash
from nnetflow.engine import Tensor from nnetflow.layers import Linear from nnetflow.module import Module from nnetflow.optim import SGD import numpy as np
Define a simple MLP
class MLP(Module): def init(self, indim, hiddendim, outdim): super().init() self.fc1 = Linear(indim, hiddendim) self.fc2 = Linear(hiddendim, out_dim)
def forward(self, x):
x = self.fc1(x).relu()
x = self.fc2(x)
return x
Generate dummy data
np.random.seed(0) X = np.random.randn(100, 3).astype(np.float32) y = (np.random.randn(100, 1) > 0).astype(np.float32)
Convert to Tensor
Xtensor = Tensor(X, requiregrad=False) ytensor = Tensor(y, requiregrad=False)
Instantiate model, loss, optimizer
model = MLP(3, 8, 1) optimizer = SGD(model.parameters(), lr=0.1)
Training loop
for epoch in range(10): optimizer.zerograd() out = model(Xtensor) # Simple MSE loss loss = ((out - y_tensor) ** 2).mean() loss.backward() optimizer.step() print(f"Epoch {epoch}, Loss: {loss.item():.4f}")
model.save("mlp_model.pkl")
Load the model
loadedmodel = Module.load("mlpmodel.pkl")
Verify loaded model
print(f"Loaded model: {loaded_model}")
Check if the loaded model can still perform inference
testout = loadedmodel(Xtensor) print(f"Test output from loaded model: {testout.data[:5]}") # Print first 5 outputs
Check if the loaded model's parameters match the original model's parameters
for originalparam, loadedparam in zip(model.parameters(), loadedmodel.parameters()): assert np.arrayequal(originalparam.data, loadedparam.data), "Loaded parameters do not match original parameters" print("All parameters match successfully after loading the model.") ```
...
See the docs/ folder for more details.
Owner
- Login: lewisnjue
- Kind: user
- Repositories: 1
- Profile: https://github.com/lewisnjue
GitHub Events
Total
- Watch event: 1
- Delete event: 1
- Issue comment event: 1
- Push event: 40
- Pull request review event: 2
- Pull request review comment event: 4
- Create event: 15
Last Year
- Watch event: 1
- Delete event: 1
- Issue comment event: 1
- Push event: 40
- Pull request review event: 2
- Pull request review comment event: 4
- Create event: 15
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 457 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 15
- Total maintainers: 1
pypi.org: nnetflow
A minimal neural network framework with autodiff and NumPy
- Homepage: https://github.com/lewisnjue/nnetflow
- Documentation: https://github.com/lewisnjue/nnetflow#readme
- License: MIT
-
Latest release: 1.0.8
published 8 months ago
Rankings
Maintainers (1)
Dependencies
- numpy *
- numpy *
- numpy *