All Projects → gokadin → Ai Simplest Network

gokadin / Ai Simplest Network

The simplest form of an artificial neural network explained and demonstrated.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Ai Simplest Network

Mariana
The Cutest Deep Learning Framework which is also a wonderful Declarative Language
Stars: ✭ 151 (-54.65%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Data Science Resources
👨🏽‍🏫You can learn about what data science is and why it's important in today's modern world. Are you interested in data science?🔋
Stars: ✭ 171 (-48.65%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Java Deep Learning Cookbook
Code for Java Deep Learning Cookbook
Stars: ✭ 156 (-53.15%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Belajarpython.com
Open Source Indonesian Python Programming Tutorial Site
Stars: ✭ 141 (-57.66%)
Mutual labels:  artificial-intelligence, tutorial
Echotorch
A Python toolkit for Reservoir Computing and Echo State Network experimentation based on pyTorch. EchoTorch is the only Python module available to easily create Deep Reservoir Computing models.
Stars: ✭ 231 (-30.63%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Awesome Quantum Machine Learning
Here you can get all the Quantum Machine learning Basics, Algorithms ,Study Materials ,Projects and the descriptions of the projects around the web
Stars: ✭ 1,940 (+482.58%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Cnn Svm
An Architecture Combining Convolutional Neural Network (CNN) and Linear Support Vector Machine (SVM) for Image Classification
Stars: ✭ 170 (-48.95%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Recommenders
Best Practices on Recommendation Systems
Stars: ✭ 11,818 (+3448.95%)
Mutual labels:  artificial-intelligence, tutorial
Aidl kb
A Knowledge Base for the FB Group Artificial Intelligence and Deep Learning (AIDL)
Stars: ✭ 219 (-34.23%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Imodels
Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).
Stars: ✭ 194 (-41.74%)
Mutual labels:  artificial-intelligence, tutorial
Deep Learning With Pytorch Tutorials
深度学习与PyTorch入门实战视频教程 配套源代码和PPT
Stars: ✭ 1,986 (+496.4%)
Mutual labels:  artificial-intelligence, tutorial
L2c
Learning to Cluster. A deep clustering strategy.
Stars: ✭ 262 (-21.32%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Lightnn
The light deep learning framework for study and for fun. Join us!
Stars: ✭ 112 (-66.37%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
100daysofmlcode
My journey to learn and grow in the domain of Machine Learning and Artificial Intelligence by performing the #100DaysofMLCode Challenge.
Stars: ✭ 146 (-56.16%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Top Deep Learning
Top 200 deep learning Github repositories sorted by the number of stars.
Stars: ✭ 1,365 (+309.91%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Perfect Tensorflow
TensorFlow C API Class Wrapper in Server Side Swift.
Stars: ✭ 166 (-50.15%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Har Keras Cnn
Human Activity Recognition (HAR) with 1D Convolutional Neural Network in Python and Keras
Stars: ✭ 97 (-70.87%)
Mutual labels:  artificial-intelligence, tutorial
Sigma
Rocket powered machine learning. Create, compare, adapt, improve - artificial intelligence at the speed of thought.
Stars: ✭ 98 (-70.57%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Free Ai Resources
🚀 FREE AI Resources - 🎓 Courses, 👷 Jobs, 📝 Blogs, 🔬 AI Research, and many more - for everyone!
Stars: ✭ 192 (-42.34%)
Mutual labels:  artificial-intelligence, artificial-neural-networks
Machine Learning And Ai In Trading
Applying Machine Learning and AI Algorithms applied to Trading for better performance and low Std.
Stars: ✭ 258 (-22.52%)
Mutual labels:  artificial-intelligence, artificial-neural-networks

Simplest artificial neural network

This is the simplest artificial neural network possible explained and demonstrated.

This is part 1 of a series of github repos on neural networks

Table of Contents

Theory

Mimicking neurons

Artificial neural networks are inspired by the brain by having interconnected artificial neurons store patterns and communicate with each other. The simplest form of an artificial neuron has one or multiple inputs each having a specific weight and one output .

alt text

At the simplest level, the output is the sum of its inputs times its weights.

A simple example

The purpose of a network is to learn a certain output given certain input(s) by approximating a complex function with many parameters that we couldn't come up with ourselves.

Say we have a network with two inputs and and two weights and .

The idea is to adjust the weights in such a way that the given inputs produce the desired output.

Weights are normally initialized randomly since we can't know their optimal value ahead of time, however for simplicity we will initialize them both to .

alt text

If we calculate the output of this network, we will get

The error

If the output doesn't match the expected target value, then we have an error.
For example, if we wanted to get a target value of then we would have a difference of

One common way to measure the error (also referred to as the cost function) is to use the mean squared error:

If we had multiple associations of inputs and target values, then the error becomes the average sum of each association.

We use the mean squared error to measure how far away the results are from our desired target. The squaring removes negative signs and gives more weight to bigger differences between output and target.

To rectify the error, we would need to adjust the weights in a way that the output matches our target. In our example, lowering from to would do the trick, since

However, in order to adjust the weights of our neural networks for many different inputs and target values, we need a learning algorithm to do this for us automatically.

Gradient descent

The idea is to use the error to understand how each weight should be adjusted so that the error is minimized, but first, we need to learn about gradients.

What is a gradient?

It's essentially a vector pointing to the direction of the steepest ascent of a function. The gradient is denoted with and is simply the partial derivative of each variable of a function expressed as a vector.

It looks like this for a two variable function:

Let's inject some numbers and calculate the gradient with a simple example. Say we have a function , then the gradient would be

What is gradient descent?

The descent part simply means using the gradient to find the direction of steepest ascent of our function and then going in the opposite direction by a small amount many times to find the function global (or sometimes local) minimum.

We use a constant called the learning rate, denoted with to define how small of a step to take in that direction.

If is too large, then we risk overshooting the function minimum, but if it's too low then the network will take longer to learn and we risk getting stuck in a shallow local minimum.

alt text

Gradient descent applied to our example network

For our two weights and we need to find the gradient of those weights with respect to the error function

For both and , we can find the gradient by using the chain rule

From now on we will denote the as the term for simplicity.

Once we have the gradient, we can update our weights by subtracting the calculated gradient times the learning rate.

And we repeat this process until the error is minimized and is close enough to zero.

Code example

The included example teaches the following dataset to a neural network with two inputs and one output using gradient descent:

Once learned, the network should output ~0 when given two s and ~ when given a and a .

How to run

Online on repl.it

Run on Repl.it

Docker

docker build -t simplest-network .
docker run --rm simplest-network

References

  1. Artificial intelligence engines by James V Stone (2019)
  2. Complete guide on deep learning: http://neuralnetworksanddeeplearning.com/chap2.html
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].