Giter VIP home page Giter VIP logo

perceptron's Introduction

Perceptron

This repo is mainly a way for me to understand neural networks, backpropagation and some basics of machine learning.

To run in, just do:

go run cmd/main.go

Sample output:

$ go run cmd/main.go
Perceptron
==========

Training....
Final error on 1000 epochs: 4.002609

Predicting....
Accuracy on 210 predictions: 99.047619%

The main program will load a dataset from UC Irvine containing a classification of wheat seeds based on its geometrical properties. Then it will create a neural network with 3 "layers":

  • an Input layer with 7 nodes (one for each input property)
  • a hidden layer with 5 nodes
  • an output layer with 3 nodes (one for each possible class of seed)

Then the network will be trained with the given dataset, and finally we again use the same dataset to let the network "predict" the classification of each seed based on its inputs.

The network configuration can be chaned in cmd/main.go on this line:

    nn := neuralnet.New(7,5,3)

Wheat Classification Neural Network

Wheat Classification Neural Network

Each "node" on the neural network is implemented as a perceptron. A perceptron is the basic unit of the network and tries to mimic the role of a neuron on the brain. There are 2 types of perceptrons: "neurons" and "sensors".

Perceptron Types

Perceptrons are connected to other perceptrons via synapses, which can be input or output synapses. Neurons have input synapses (meaning they receive signals from other perceptrons) and may have output synapses. Only the outer "output" layer of neurons do not have output synapses.

Sensors are simplified Perceptrons. They only connect to other neurons via output synapses. Their role is to "sense" external values and feed them into the neural network.

All perceptrons have a value, an error measure (calculated during training when comparing the expected value with their actual value), a bias and and activation function. Bias and Activation functions are used to transform the inputs received into the output that is fed to the connected neurons.

Every synapse also has a weight, which determines "how much" that particular signal from the source neuron affects the target neuron. The "training" of a network is the process by which all weights are fine-tuned so that the desired output is achieved.

An important detail is that an individual node has no knowledge of the network as a whole. The neuron is only "aware" of its inmmediate surroundings and can only "see" its inputs and generate a signal to pass to its connected neurons (if any). Even the training process is based on propagating signals via the existing connections on the network. Each node tells its connected nodes to "train" itself.

perceptron's People

Contributors

oarevalo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.