# npnn **Repository Path**: xforcevesa/npnn ## Basic Information - **Project Name**: npnn - **Description**: A Ultra Lightweight Neural Network Engine totally based on NumPy - **Primary Language**: Python - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-15 - **Last Updated**: 2025-11-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # NPNN: 基于 NumPy 的超轻量级神经网络引擎 NPNN 是一个基于 NumPy 的轻量级神经网络引擎,旨在提供简单易用的接口用于实现和训练神经网络模型。该项目适合用于学习神经网络的基本原理和实现细节。 ## 功能特性 - 实现了梯度下降和反向传播算法 - 提供了基本的神经网络操作符,如加法、乘法、矩阵乘法、ReLU 激活函数、Softmax 激活函数等 - 支持基本的优化器和损失函数,如交叉熵损失、均方误差损失等 - 提供了用于测试和演示的 MNIST 手写数字识别示例 ## 安装要求 - Python >= 3.7 - scikit-learn - matplotlib - numpy ## 运行测试 安装依赖: ```bash pip install scikit-learn matplotlib numpy ``` 运行测试: ```bash python test_mnist.py ``` ## 示例结果 训练过程中生成的损失和准确率曲线如下所示: ![Training Analysis](./training_analysis_composite.png) ![MNIST Training Curves](./mnist_training_curves.png) ## 项目结构 - `npnn/functional.py`: 提供常用的激活函数和损失函数 - `npnn/model.py`: 实现神经网络模型的基本组件,如线性层 - `npnn/ops.py`: 实现神经网络中的各种操作符,如加法、乘法、矩阵乘法等 - `npnn/optim.py`: 提供优化器的基本实现 - `npnn/tensor.py`: 实现神经网络中的张量数据结构 - `test_mnist.py`: 提供 MNIST 手写数字识别的测试示例 ## 贡献 欢迎贡献代码和文档,帮助完善 NPNN 项目。请提交 Pull Request 或报告问题。 ## 许可证 该项目遵循 MIT 许可证。详情请查看 LICENSE 文件。