• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

GarethRichards/Machine-Learning-CPP: Code from Michael Nielsen book Neural Netwo ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

GarethRichards/Machine-Learning-CPP

开源软件地址(OpenSource Url):

https://github.com/GarethRichards/Machine-Learning-CPP

开源编程语言(OpenSource Language):

C++ 91.1%

开源软件介绍(OpenSource Introduction):

Machine Learning with C++

The C++ code in this repository is a hopefully accurate port of the python code in Michael Nielsen's book Neural Networks and Deep Learning. I recommend you to read Michael Nielson's book and if you wish to use C++ rather than python you can use the code in this repository to supplement your understanding. I would also like to thank Grant Sanderson, 3Blue1Brown for his entertaining and educational videos on Machine learning and for introducing me to Michael's book. If you're new to Machine learning I can also recommend as an excellent introduction Machine Learning by Stanford University on Coursera. Finally, thanks to the people who created the MNIST dataset for making their dataset available to us.

I've aimed to produce code as simple and concise as possible using only the features in the standard C++17, but as the standard library does not contain a linear algebra library I've used the uBLAS. I've tried to showcase some of the new features of Modern C++ here, STL algorithms and lambda functions. With just a couple of 100 lines of code we can produce a program which can recognize handwritten digits and implements the standard learning algorithm for neural networks, known as stochastic gradient descent.

Chapter 1

In chapter 1 A C++ version of network.py is constructed in Python style as all the code is in one cpp file. The purpose of this version is to create code similar to the python code, rather than the best C++ possible, to allow you to read Using neural nets to recognize handwritten digits and follow the online book with C++.

Chapter 2

Michael explains how the backpropagation algorithm works but adds no more Python code to his book. Giving me time to read up on some C++17 features I'd like to try out.

Chapter 3

This time I'm aiming to produce C++ worthy of being called a library, but still maintaining code which is recognisable to the python network2.py from chapter 3 of Michael's book. Of course the main body of the code goes into a header file and I show how to construct some policy classes and how to use them in Network2.cpp.

Future

The code written so far all runs in a single thread. Of course thanks to the C++ compilers vectorization skills it is able to do its job in a reasonable amount of time. In C++ 17 the Extensions for parallelism TR lets us change the execution plan of algorithms. I introduce Structured bindings into the codebase which increase conciseness and readability. Finally, I use some ideas outlined in Michael's book and add different activation functions to the library.

Final thoughts

I hope you enjoyed this excursion into both C++ and Machine learning. I started writing this code as I was unable to find any easily approachable code for experimenting with Machine learning in C++. Once again thanks to Michael Nielsen for writing such an accessible and readable book.

Gareth Richards 14/11/2017




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap