Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

miniMNIST-c

> 编程语言
Open source

miniMNIST-c This project implements a minimal neural network in C for classifying handwritten digits from the MNIST dataset. The entire imp…

1.3K stars0 likes1 views
WebsiteGitHub

About

miniMNIST-c This project implements a minimal neural network in C for classifying handwritten digits from the MNIST dataset. The entire imp…

miniMNIST-c

This project implements a minimal neural network in C for classifying handwritten digits from the MNIST dataset. The entire implementation is ~200 lines of code and uses only the standard C library.

Features

  • Two-layer neural network (input → hidden → output)
  • ReLU activation function for the hidden layer
  • Softmax activation function for the output layer
  • Cross-entropy loss function
  • Stochastic Gradient Descent (SGD) optimizer

Performance

…

Prerequisites

  • GCC compiler
  • MNIST dataset files:
    • train-images.idx3-ubyte
    • train-labels.idx1-ubyte

Compilation

bash
gcc -O3 -march=native -ffast-math -o nn nn.c -lm

Usage

  1. Place the MNIST dataset files in the data/ directory.

  2. Compile the program.

  3. Run the executable:

    bash
    ./nn

The program will train the neural network on the MNIST dataset and output the accuracy and average loss for each epoch.

Configuration

You can adjust the following parameters in nn.c:

  • HIDDEN_SIZE: Number of neurons in the hidden layer
  • LEARNING_RATE: Learning rate for SGD
  • EPOCHS: Number of training epochs
  • BATCH_SIZE: Mini-batch size for training
  • TRAIN_SPLIT: Proportion of data used for training (the rest is used for testing)

License

This project is open-source and available under the MIT License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言