{"id":32990436,"url":"https://github.com/yixuan/MiniDNN","last_synced_at":"2025-11-15T09:01:22.085Z","repository":{"id":39630215,"uuid":"118344819","full_name":"yixuan/MiniDNN","owner":"yixuan","description":"A header-only C++ library for deep neural networks","archived":false,"fork":false,"pushed_at":"2021-04-16T09:25:56.000Z","size":724,"stargazers_count":425,"open_issues_count":12,"forks_count":96,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-10-13T04:29:49.660Z","etag":null,"topics":["deep-learning","header-only","machine-learning","neural-network","statistical-models"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yixuan.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}},"created_at":"2018-01-21T15:02:01.000Z","updated_at":"2025-09-12T22:09:49.000Z","dependencies_parsed_at":"2022-08-27T23:30:50.334Z","dependency_job_id":null,"html_url":"https://github.com/yixuan/MiniDNN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yixuan/MiniDNN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2FMiniDNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2FMiniDNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2FMiniDNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2FMiniDNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yixuan","download_url":"https://codeload.github.com/yixuan/MiniDNN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2FMiniDNN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284530944,"owners_count":27021188,"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-11-15T02:00:06.050Z","response_time":57,"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":["deep-learning","header-only","machine-learning","neural-network","statistical-models"],"created_at":"2025-11-13T09:00:29.690Z","updated_at":"2025-11-15T09:01:22.065Z","avatar_url":"https://github.com/yixuan.png","language":"C++","funding_links":[],"categories":["[Libraries](#awesome-robotics-libraries)","Data Mining, Machine Learning, and Deep Learning"],"sub_categories":["[Machine Learning](#awesome-robotics-libraries)"],"readme":"# MiniDNN\n\n**MiniDNN** is a C++ library that implements a number of popular\ndeep neural network (DNN) models. It has a mini codebase but is fully functional\nto construct different types of feed-forward neural networks. **MiniDNN** is\nbuilt on top of [Eigen](http://eigen.tuxfamily.org).\n\n**MiniDNN** is a header-only library implemented purely in C++98, whose only\ndependency, **Eigen**, is also header-only. These features make it easy to embed\n**MiniDNN** into larger projects with a broad range of compiler support.\n\nThis project was largely inspired by the [tiny-dnn](https://github.com/tiny-dnn/tiny-dnn/)\nlibrary, a header-only C++14 implementation of deep learning models. What makes\n**MiniDNN** different is that **MiniDNN** is based on the high-performance **Eigen**\nlibrary for numerical computing, and it has better compiler support.\n\n**MiniDNN** is still quite **experimental** for now. Originally I wrote it with the aim of\nstudying deep learning and practicing model implementation, but I also find it useful in\nmy own statistical and machine learning research projects.\n\n## Features\n\n- Able to build feed-forward neural networks with a few lines of code\n- Header-only, highly portable\n- Fast on CPU\n- Modularized and extensible\n- Provides detailed documentation that is a resource for learning\n- Helps understanding how DNN works\n- A wonderful opportunity to learn and practice both the nice and dirty parts of DNN\n\n## Quick Start\n\nThe self-explanatory code below is a minimal example to fit a DNN model:\n\n```cpp\n#include \u003cMiniDNN.h\u003e\n\nusing namespace MiniDNN;\n\ntypedef Eigen::MatrixXd Matrix;\ntypedef Eigen::VectorXd Vector;\n\nint main()\n{\n    // Set random seed and generate some data\n    std::srand(123);\n    // Predictors -- each column is an observation\n    Matrix x = Matrix::Random(400, 100);\n    // Response variables -- each column is an observation\n    Matrix y = Matrix::Random(2, 100);\n\n    // Construct a network object\n    Network net;\n\n    // Create three layers\n    // Layer 1 -- convolutional, input size 20x20x1, 3 output channels, filter size 5x5\n    Layer* layer1 = new Convolutional\u003cReLU\u003e(20, 20, 1, 3, 5, 5);\n    // Layer 2 -- max pooling, input size 16x16x3, pooling window size 3x3\n    Layer* layer2 = new MaxPooling\u003cReLU\u003e(16, 16, 3, 3, 3);\n    // Layer 3 -- fully connected, input size 5x5x3, output size 2\n    Layer* layer3 = new FullyConnected\u003cIdentity\u003e(5 * 5 * 3, 2);\n\n    // Add layers to the network object\n    net.add_layer(layer1);\n    net.add_layer(layer2);\n    net.add_layer(layer3);\n\n    // Set output layer\n    net.set_output(new RegressionMSE());\n\n    // Create optimizer object\n    RMSProp opt;\n    opt.m_lrate = 0.001;\n\n    // (Optional) set callback function object\n    VerboseCallback callback;\n    net.set_callback(callback);\n\n    // Initialize parameters with N(0, 0.01^2) using random seed 123\n    net.init(0, 0.01, 123);\n\n    // Fit the model with a batch size of 100, running 10 epochs with random seed 123\n    net.fit(opt, x, y, 100, 10, 123);\n\n    // Obtain prediction -- each column is an observation\n    Matrix pred = net.predict(x);\n\n    // Layer objects will be freed by the network object,\n    // so do not manually delete them\n\n    return 0;\n}\n```\n\nTo compile and run this example, simply download the source code of **MiniDNN** and\n[Eigen](http://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz),\nand let the compiler know about their paths. For example:\n\n```bash\ng++ -O2 -I/path/to/eigen -I/path/to/MiniDNN/include example.cpp\n```\n\n## Documentation\n\nThe [API reference](https://yixuan.cos.name/MiniDNN/doc/) page contains the documentation\nof **MiniDNN** generated by [Doxygen](http://www.doxygen.org/), including all the class APIs.\n\n## License\n\n**MiniDNN** is an open source project licensed under\n[MPL2](https://www.mozilla.org/MPL/2.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyixuan%2FMiniDNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyixuan%2FMiniDNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyixuan%2FMiniDNN/lists"}