https://github.com/skivhisink/miniflow
Library for creating NeuralNetrworks on C++ built on MiniFlow library for python
https://github.com/skivhisink/miniflow
Last synced: 10 months ago
JSON representation
Library for creating NeuralNetrworks on C++ built on MiniFlow library for python
- Host: GitHub
- URL: https://github.com/skivhisink/miniflow
- Owner: SkivHisink
- Created: 2020-11-06T00:36:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-06-15T10:05:17.000Z (about 1 year ago)
- Last Synced: 2025-06-15T11:19:55.607Z (about 1 year ago)
- Language: C++
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MiniFlow
MiniFlow is a lightweight C++ library for creating neural networks. It is inspired by the simplicity and design of the Python [MiniFlow library](https://github.com/karpathy/miniflow) and adapts its core concepts to C++. The goal of MiniFlow is to provide an intuitive, modular framework that makes it easy to experiment with neural network architectures and training routines in C++.
---
## Table of Contents
- [Overview](#overview)
- [Folder Structure](#folder-structure)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Building the Project](#building-the-project)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgments](#acknowledgments)
---
## Overview
MiniFlow offers a simple API for constructing, training, and evaluating neural networks in C++. Whether you are looking to learn about neural network fundamentals or integrate custom network components into a larger C++ project, MiniFlow provides a minimal framework to get you started.
Key features include:
- **Simplicity:** Minimalistic design for easy understanding and extension.
- **Modularity:** Separate components for data, network layers, and training routines.
- **Extensibility:** Easily integrate custom layers and training algorithms.
---
## Folder Structure
The repository is organized as follows:
- **BostonData/**
Contains sample datasets (for example, the Boston Housing dataset) to experiment with network training and evaluation.
- **MiniFlow/**
May include example scripts and demo applications that illustrate how to use the library.
- **MiniFlowLib/**
Houses the core library source code. This is where the building blocks of the neural network (such as layer definitions, forward/backward propagation routines, etc.) are implemented.
- **NeuralNetwork/**
Contains higher-level implementations and sample neural network architectures that utilize the MiniFlowLib components.
- **MiniFlow.sln**
A Visual Studio solution file to help build and run the project on Windows.
---
## Getting Started
### Prerequisites
- A C++ compiler (Visual Studio 2019 or later is recommended for Windows users).
- CMake (if you plan to build on non-Windows platforms; see below for notes).
- Standard C++ libraries (the project uses C++11/14 features).
### Installation
1. **Clone the Repository**
```bash
git clone https://github.com/SkivHisink/MiniFlow.git
```
2. **Navigate to the Repository Directory**
```bash
cd MiniFlow
```
3. **Open the Project**
- **Windows:** Open `MiniFlow.sln` in Visual Studio and build the solution.
- **Other Platforms:** (If applicable) Create a CMake project or makefile based on the provided source code.
---
## Usage
Below is a simple example of how you might use MiniFlow in your own C++ project:
```cpp
#include "NeuralNetwork/NeuralNetwork.h"
int main() {
// Create an instance of your neural network
NeuralNetwork nn;
// Configure your network (e.g., add layers, set learning rate)
nn.addLayer(new DenseLayer(10, 5)); // Example: from 10 inputs to 5 neurons
nn.addLayer(new ActivationLayer("relu"));
// Load sample data from the BostonData folder (implementation-specific)
DataSet trainingData = DataLoader::load("BostonData/training.csv");
// Train the network
nn.train(trainingData, /* epochs */ 100, /* learning rate */ 0.01);
// Evaluate the network
double accuracy = nn.evaluate(trainingData);
std::cout << "Training Accuracy: " << accuracy << std::endl;
return 0;
}
```
*Note:* The above code is illustrative. Adjust class names and function calls based on the actual implementation provided in MiniFlowLib and NeuralNetwork folders.
---
## Building the Project
- **Windows:**
Open `MiniFlow.sln` with Visual Studio and build the solution.
- **Linux/macOS:**
If you prefer to use CMake, create a `CMakeLists.txt` file (if not already provided) and configure your build environment. For example:
```cmake
cmake_minimum_required(VERSION 3.10)
project(MiniFlow)
set(CMAKE_CXX_STANDARD 14)
# Add directories containing the library source files
add_subdirectory(MiniFlowLib)
add_subdirectory(NeuralNetwork)
# Add your executable target and link against the library targets
add_executable(MiniFlowDemo MiniFlow/main.cpp)
target_link_libraries(MiniFlowDemo PRIVATE MiniFlowLib NeuralNetwork)
```
Then, run:
```bash
mkdir build && cd build
cmake ..
make
```
---
## Contributing
Contributions are welcome! If you have suggestions, bug fixes, or new features to add, please feel free to open an issue or submit a pull request.
Before contributing, please review our [Contributing Guidelines](CONTRIBUTING.md) (if available) to ensure a smooth process.
---
## License
This project is distributed under the MIT License. See the [LICENSE](LICENSE) file for details.
---
## Acknowledgments
- Inspiration from the original [MiniFlow Python library](https://github.com/karpathy/miniflow) and various educational resources on neural network design.
- Thanks to the contributors and maintainers of open-source neural network projects for their valuable insights.