All Projects → OmarAflak → first-neural-network

OmarAflak / first-neural-network

Licence: other
Simple neural network implemented from scratch in C++.

Programming Languages

C++
36643 projects - #6 most used programming language
shell
77523 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to first-neural-network

teaching-open
Scratch少儿编程教学平台,集成Scratch、ScratchJr、Python教学工具。包含课程、班级、作业、权限、赛事、社区等。
Stars: ✭ 202 (+1088.24%)
Mutual labels:  scratch
TP Arduino DigitalRain Anim
A library that represents Digital Rain Animation on color displays that support TFT_eSPI
Stars: ✭ 80 (+370.59%)
Mutual labels:  matrix
zombi-addons
No description or website provided.
Stars: ✭ 15 (-11.76%)
Mutual labels:  matrix
oxygenjs
This a JavaScript Library for the Numerical Javascript and Machine Learning
Stars: ✭ 13 (-23.53%)
Mutual labels:  matrix
gobo.icu
URL Shortener For Scratch
Stars: ✭ 14 (-17.65%)
Mutual labels:  scratch
machine-learning-course
Machine Learning Course @ Santa Clara University
Stars: ✭ 17 (+0%)
Mutual labels:  supervised-learning
Matrix
Easy-to-use Scientific Computing library in/for C++ available for Linux and Windows.
Stars: ✭ 20 (+17.65%)
Mutual labels:  matrix
Hand-Gesture-Recognition-Using-Background-Elllimination-and-Convolution-Neural-Network
Hand Gesture Recognition using Convolution Neural Network built using Tensorflow, OpenCV and python
Stars: ✭ 120 (+605.88%)
Mutual labels:  supervised-learning
Python-TensorFlow-WebApp
Emerging Technologies Project - 4th Year 2017
Stars: ✭ 16 (-5.88%)
Mutual labels:  digits-recognition
vue-scratchable
A Vue.js wrapper component that turns everything into fun scratch cards.
Stars: ✭ 42 (+147.06%)
Mutual labels:  scratch
geeks-for-geeks-solutions
✅ My own Amazon, Microsoft and Google SDE Coding challenge Solutions (offered by GeeksForGeeks).
Stars: ✭ 246 (+1347.06%)
Mutual labels:  matrix
go
A Golang Matrix framework.
Stars: ✭ 192 (+1029.41%)
Mutual labels:  matrix
botdarr
Slack/Discord/Telegram/Matrix bot for accessing radarr, sonarr, and lidarr
Stars: ✭ 76 (+347.06%)
Mutual labels:  matrix
robo-vln
Pytorch code for ICRA'21 paper: "Hierarchical Cross-Modal Agent for Robotics Vision-and-Language Navigation"
Stars: ✭ 34 (+100%)
Mutual labels:  supervised-learning
matrix-tag-manager
A web interface for supporting power users and their Matrix room tags.
Stars: ✭ 22 (+29.41%)
Mutual labels:  matrix
ProbQA
Probabilistic question-asking system: the program asks, the users answer. The minimal goal of the program is to identify what the user needs (a target), even if the user is not aware of the existence of such a thing/product/service.
Stars: ✭ 43 (+152.94%)
Mutual labels:  matrix
textlytics
Text processing library for sentiment analysis and related tasks
Stars: ✭ 25 (+47.06%)
Mutual labels:  supervised-learning
SRScratchView
A mask imageView class which can be used a scratchView.
Stars: ✭ 52 (+205.88%)
Mutual labels:  scratch
addon-matrix
Matrix - Home Assistant Community Add-ons
Stars: ✭ 39 (+129.41%)
Mutual labels:  matrix
hlml
vectorized high-level math library
Stars: ✭ 42 (+147.06%)
Mutual labels:  matrix

Neural Network in C++

A neural network implemented with matrices in C++, from scratch !

This program is meant to be used for supervised learning.

What's in there ?

  • src/XOR : Learning XOR operation.
  • src/XOR_PLOT : Learning XOR operation and plot weights variation on a graph (using python).
  • src/Digits-Recognition : Learning to recognize hand-written digits with a training file.

Download, Compile & Run

git clone https://github.com/omaflak/Neural-Network
cd Neural-Network/src
git submodule update --init

# cd into one of the directories above and:
sh compile.sh
./main

Network Class

The Network class contains the gradient descent algorithm.

Both src/XOR and src/Digit-Recognition are using it. Quick description :

// constructor
// vector 'neurons' should contain:
// - number of input neurons at first index
// - number of output neurons at last index
// - number of hidden neurons in between
// example: {2,5,3,1} = 2 input neurons, 1 output neuron, 2 hidden layers (5 neurons and 3 neurons respectively)
// learning rate : experimental
Network(std::vector<int> neurons, double learningRate);

// make prediction
Matrix<double> computeOutput(std::vector<double> input);

// learns from the previous computeOutput()
void learn(std::vector<double> expectedOutput);

// save all network's parameters into a file (after a training)
void saveNetworkParams(const char *filepath);

// load network's parameters from a file so you don't have to train it again
void loadNetworkParams(const char *filepath);
// or use the constructor
Network(const char *filepath);

Plot

I was curious to see what would've happened if I had plotted the network's parameters on a graph, so I did it, and the result is actually fun :)

The program was learning XOR operation and saving it's weights and error variation over time.

Then I plotted the data using plotly

EDIT: I updated the repo and now there is a python script called plotXY.py at src/ that will do the job instead. Try to compile and run src/XOR_PLOT.

And here is the result :

alt tag alt tag

We can see that the program is actually working: while the weights are converging to specific values, the error is decreasing.

Amen !

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].