c语言实现神经网络MNIST,MNIST数据集的神经网络实现,用普通的C语言编写

这个博客分享了一段C语言代码,用于实现MNIST数据集的手写数字识别任务。代码实现了一个简单的神经网络,没有隐藏层,采用softmax激活函数和交叉熵损失函数。经过约1000步训练,模型能达到约92%的识别准确率。
摘要由CSDN通过智能技术生成

MNIST Neural Network in C

This source code seeks to replicate the MNIST For ML Beginners tutorial from the Tensorflow website using plain C code.

The task is to recognise digits, such as the ones below, as accurately as possible.

68747470733a2f2f7777772e74656e736f72666c6f772e6f72672f76657273696f6e732f72312e312f696d616765732f4d4e4953542e706e67

Contents

mnist.c: Glue code that runs the algorithm steps and reports algorithm accuracy

mnist_file.c: Retrieves images and labels from the MNIST dataset

neural_network.c: Implements training and prediction routines for a simple neural network

Usage

make

./mnist

Description

The neural network implemented has one output layer and no hidden layers. Softmax activation is used, and this ensures that the output activations form a probability vector corresponding to each label. The cross entropy is used as a loss function.

The algorithm reaches an accuracy of around 92% over 1000 steps.

Expected Output

Step 0000Average Loss: 4.36Accuracy: 0.152

Step 0001Average Loss: 3.42Accuracy: 0.188

Step 0002Average Loss: 2.97Accuracy: 0.298

Step 0003Average Loss: 2.53Accuracy: 0.319

Step 0004Average Loss: 2.19Accuracy: 0.412

Step 0005Average Loss: 2.08Accuracy: 0.437

Step 0006Average Loss: 1.73Accuracy: 0.468

Step 0007Average Loss: 1.51Accuracy: 0.447

Step 0008Average Loss: 1.57Accuracy: 0.496

Step 0009Average Loss: 1.45Accuracy: 0.516

Step 0010Average Loss: 1.78Accuracy: 0.559

...

3781365ddb1ed04131933e7c417135a1.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值