All Projects → jczic → Micromlp

jczic / Micromlp

Licence: mit
A micro neural network multilayer perceptron for MicroPython (used on ESP32 and Pycom modules)

Programming Languages

python
139335 projects - #7 most used programming language
micropython
64 projects

Projects that are alternatives of or similar to Micromlp

Basic reinforcement learning
An introductory series to Reinforcement Learning (RL) with comprehensive step-by-step tutorials.
Stars: ✭ 826 (+797.83%)
Mutual labels:  artificial-intelligence, ai, deeplearning, q-learning
Best ai paper 2020
A curated list of the latest breakthroughs in AI by release date with a clear video explanation, link to a more in-depth article, and code
Stars: ✭ 2,140 (+2226.09%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Airsim
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
Stars: ✭ 12,528 (+13517.39%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Pycm
Multi-class confusion matrix library in Python
Stars: ✭ 1,076 (+1069.57%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Fixy
Amacımız Türkçe NLP literatüründeki birçok farklı sorunu bir arada çözebilen, eşsiz yaklaşımlar öne süren ve literatürdeki çalışmaların eksiklerini gideren open source bir yazım destekleyicisi/denetleyicisi oluşturmak. Kullanıcıların yazdıkları metinlerdeki yazım yanlışlarını derin öğrenme yaklaşımıyla çözüp aynı zamanda metinlerde anlamsal analizi de gerçekleştirerek bu bağlamda ortaya çıkan yanlışları da fark edip düzeltebilmek.
Stars: ✭ 165 (+79.35%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Text summurization abstractive methods
Multiple implementations for abstractive text summurization , using google colab
Stars: ✭ 359 (+290.22%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Ffdl
Fabric for Deep Learning (FfDL, pronounced fiddle) is a Deep Learning Platform offering TensorFlow, Caffe, PyTorch etc. as a Service on Kubernetes
Stars: ✭ 640 (+595.65%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Autodl
Automated Deep Learning without ANY human intervention. 1'st Solution for AutoDL [email protected]
Stars: ✭ 854 (+828.26%)
Mutual labels:  artificial-intelligence, ai, deeplearning
Mumbai Ai Meetup
Repository for all the content presented in the Mumbai AI Meetup - https://www.meetup.com/mumbai-ai-meetup
Stars: ✭ 48 (-47.83%)
Mutual labels:  artificial-intelligence, ai
Notebooks
Some notebooks
Stars: ✭ 53 (-42.39%)
Mutual labels:  artificial-intelligence, q-learning
Evalai
☁️ 🚀 📊 📈 Evaluating state of the art in AI
Stars: ✭ 1,087 (+1081.52%)
Mutual labels:  artificial-intelligence, ai
Gbrain
GPU Javascript Library for Machine Learning
Stars: ✭ 48 (-47.83%)
Mutual labels:  ai, deeplearning
Deep traffic
MIT DeepTraffic top 2% solution (75.01 mph) 🚗.
Stars: ✭ 47 (-48.91%)
Mutual labels:  artificial-intelligence, q-learning
Openvoiceos
OpenVoiceOS is a minimalistic linux OS bringing the open source voice assistant Mycroft A.I. to embbeded, low-spec headless and/or small (touch)screen devices.
Stars: ✭ 64 (-30.43%)
Mutual labels:  artificial-intelligence, ai
Clarifai Apple Sdk
Artificial Intelligence with a Vision
Stars: ✭ 46 (-50%)
Mutual labels:  artificial-intelligence, ai
Tabnine
AI Code Completions
Stars: ✭ 8,863 (+9533.7%)
Mutual labels:  artificial-intelligence, ai
Coursera Natural Language Processing Specialization
Programming assignments from all courses in the Coursera Natural Language Processing Specialization offered by deeplearning.ai.
Stars: ✭ 39 (-57.61%)
Mutual labels:  artificial-intelligence, deeplearning
Tic Tac Toe
An unbeatable game of Tic Tac Toe.
Stars: ✭ 57 (-38.04%)
Mutual labels:  artificial-intelligence, ai
Aif360
A comprehensive set of fairness metrics for datasets and machine learning models, explanations for these metrics, and algorithms to mitigate bias in datasets and models.
Stars: ✭ 1,312 (+1326.09%)
Mutual labels:  artificial-intelligence, ai
Caffe2
Caffe2 is a lightweight, modular, and scalable deep learning framework.
Stars: ✭ 8,409 (+9040.22%)
Mutual labels:  artificial-intelligence, ai

MicroMLP is a micro artificial neural network multilayer perceptron (principally used on ESP32 and Pycom modules)

HC²

Very easy to integrate and very light with one file only :

  • "microMLP.py"

MicroMLP features :

  • Modifiable multilayer and connections structure
  • Integrated bias on neurons
  • Plasticity of the connections included
  • Activation functions by layer
  • Parameters Alpha, Eta and Gain
  • Managing set of examples and learning
  • QLearning functions to use reinforcement learning
  • Save and load all structure to/from json file
  • Various activation functions :
    • Heaviside binary step
    • Logistic (sigmoid or soft step)
    • Hyperbolic tangent
    • SoftPlus rectifier
    • ReLU (rectified linear unit)
    • Gaussian function

Use deep learning for :

  • Signal processing (speech processing, identification, filtering)
  • Image processing (compression, recognition, patterns)
  • Control (diagnosis, quality control, robotics)
  • Optimization (planning, traffic regulation, finance)
  • Simulation (black box simulation)
  • Classification (DNA analysis)
  • Approximation (unknown function, complex function)

Using MicroMLP static functions :

Name Function
Create mlp = MicroMLP.Create(neuronsByLayers, activationFuncName, layersAutoConnectFunction=None, useBiasValue=1.0)
LoadFromFile mlp = MicroMLP.LoadFromFile(filename)

Using MicroMLP speedly creation of a neural network :

from microMLP import MicroMLP
mlp = MicroMLP.Create([3, 10, 2], "Sigmoid", MicroMLP.LayersFullConnect)

Using MicroMLP main class :

Name Function
Constructor mlp = MicroMLP()
GetLayer layer = mlp.GetLayer(layerIndex)
GetLayerIndex idx = mlp.GetLayerIndex(layer)
RemoveLayer mlp.RemoveLayer(layer)
GetInputLayer inputLayer = mlp.GetInputLayer()
GetOutputLayer outputLayer = mlp.GetOutputLayer()
Learn ok = mlp.Learn(inputVectorNNValues, targetVectorNNValues)
Test ok = mlp.Test(inputVectorNNValues, targetVectorNNValues)
Predict outputVectorNNValues = mlp.Predict(inputVectorNNValues)
QLearningLearnForChosenAction ok = mlp.QLearningLearnForChosenAction(stateVectorNNValues, rewardNNValue, pastStateVectorNNValues, chosenActionIndex, terminalState=True, discountFactorNNValue=None)
QLearningPredictBestActionIndex bestActionIndex = mlp.QLearningPredictBestActionIndex(stateVectorNNValues)
SaveToFile ok = mlp.SaveToFile(filename)
AddExample ok = mlp.AddExample(inputVectorNNValues, targetVectorNNValues)
ClearExamples mlp.ClearExamples()
LearnExamples learnCount = mlp.LearnExamples(maxSeconds=30, maxCount=None, stopWhenLearned=True, printMAEAverage=True)
Property Example Read/Write
Layers mlp.Layers get
LayersCount mlp.LayersCount get
IsNetworkComplete mlp.IsNetworkComplete get
MSE mlp.MSE get
MAE mlp.MAE get
MSEPercent mlp.MSEPercent get
MAEPercent mlp.MAEPercent get
ExamplesCount mlp.ExamplesCount get

Using MicroMLP to learn the XOr problem (with hyperbolic tangent) :

from microMLP import MicroMLP

mlp = MicroMLP.Create( neuronsByLayers           = [2, 2, 1],
                       activationFuncName        = MicroMLP.ACTFUNC_TANH,
                       layersAutoConnectFunction = MicroMLP.LayersFullConnect )

nnFalse  = MicroMLP.NNValue.FromBool(False)
nnTrue   = MicroMLP.NNValue.FromBool(True)

mlp.AddExample( [nnFalse, nnFalse], [nnFalse] )
mlp.AddExample( [nnFalse, nnTrue ], [nnTrue ] )
mlp.AddExample( [nnTrue , nnTrue ], [nnFalse] )
mlp.AddExample( [nnTrue , nnFalse], [nnTrue ] )

learnCount = mlp.LearnExamples()

print( "LEARNED :" )
print( "  - False xor False = %s" % mlp.Predict([nnFalse, nnFalse])[0].AsBool )
print( "  - False xor True  = %s" % mlp.Predict([nnFalse, nnTrue] )[0].AsBool )
print( "  - True  xor True  = %s" % mlp.Predict([nnTrue , nnTrue] )[0].AsBool )
print( "  - True  xor False = %s" % mlp.Predict([nnTrue , nnFalse])[0].AsBool )

if mlp.SaveToFile("mlp.json") :
	print( "MicroMLP structure saved!" )
Variable Description Default
mlp.Eta Weighting of the error correction 0.30
mlp.Alpha Strength of connections plasticity 0.75
mlp.Gain Network learning gain 0.99
mlp.CorrectLearnedMAE Threshold of self-learning error 0.02
Graphe Activation function name Const Detail
HC² "Heaviside" MicroMLP.ACTFUNC_HEAVISIDE Heaviside binary step
HC² "Sigmoid" MicroMLP.ACTFUNC_SIGMOID Logistic (sigmoid or soft step)
HC² "TanH" MicroMLP.ACTFUNC_TANH Hyperbolic tangent
HC² "SoftPlus" MicroMLP.ACTFUNC_SOFTPLUS SoftPlus rectifier
HC² "ReLU" MicroMLP.ACTFUNC_RELU Rectified linear unit
HC² "Gaussian" MicroMLP.ACTFUNC_GAUSSIAN Gaussian function
Layers auto-connect function Detail
MicroMLP.LayersFullConnect Network fully connected

Using MicroMLP.Layer class :

Name Function
Constructor layer = MicroMLP.Layer(parentMicroMLP, activationFuncName=None, neuronsCount=0)
GetLayerIndex idx = layer.GetLayerIndex()
GetNeuron neuron = layer.GetNeuron(neuronIndex)
GetNeuronIndex idx = layer.GetNeuronIndex(neuron)
AddNeuron layer.AddNeuron(neuron)
RemoveNeuron layer.RemoveNeuron(neuron)
GetMeanSquareError mse = layer.GetMeanSquareError()
GetMeanAbsoluteError mae = layer.GetMeanAbsoluteError()
GetMeanSquareErrorAsPercent mseP = layer.GetMeanSquareErrorAsPercent()
GetMeanAbsoluteErrorAsPercent maeP = layer.GetMeanAbsoluteErrorAsPercent()
Remove layer.Remove()
Property Example Read/Write
ParentMicroMLP layer.ParentMicroMLP get
ActivationFuncName layer.ActivationFuncName get
Neurons layer.Neurons get
NeuronsCount layer.NeuronsCount get

Using MicroMLP.InputLayer(Layer) class :

Name Function
Constructor inputLayer = MicroMLP.InputLayer(parentMicroMLP, neuronsCount=0)
SetInputVectorNNValues ok = inputLayer.SetInputVectorNNValues(inputVectorNNValues)

Using MicroMLP.OutputLayer(Layer) class :

Name Function
Constructor outputLayer = MicroMLP.OutputLayer(parentMicroMLP, activationFuncName, neuronsCount=0)
GetOutputVectorNNValues outputVectorNNValues = outputLayer.GetOutputVectorNNValues()
ComputeTargetLayerError ok = outputLayer.ComputeTargetLayerError(targetVectorNNValues)

Using MicroMLP.Neuron class :

Name Function
Constructor neuron = MicroMLP.Neuron(parentLayer)
GetNeuronIndex idx = neuron.GetNeuronIndex()
GetInputConnections connections = neuron.GetInputConnections()
GetOutputConnections connections = neuron.GetOutputConnections()
AddInputConnection neuron.AddInputConnection(connection)
AddOutputConnection neuron.AddOutputConnection(connection)
RemoveInputConnection neuron.RemoveInputConnection(connection)
RemoveOutputConnection neuron.RemoveOutputConnection(connection)
SetBias neuron.SetBias(bias)
GetBias neuron.GetBias()
SetOutputNNValue neuron.SetOutputNNValue(nnvalue)
ComputeValue neuron.ComputeValue()
ComputeError neuron.ComputeError(targetNNValue=None)
Remove neuron.Remove()
Property Example Read/Write
ParentLayer neuron.ParentLayer get
ComputedOutput neuron.ComputedOutput get
ComputedDeltaError neuron.ComputedDeltaError get
ComputedSignalError neuron.ComputedSignalError get

Using MicroMLP.Connection class :

Name Function
Constructor connection = MicroMLP.Connection(neuronSrc, neuronDst, weight=None)
UpdateWeight connection.UpdateWeight(eta, alpha)
Remove connection.Remove()
Property Example Read/Write
NeuronSrc connection.NeuronSrc get
NeuronDst connection.NeuronDst get
Weight connection.Weight get

Using MicroMLP.Bias class :

Name Function
Constructor bias = MicroMLP.Bias(neuronDst, value=1.0, weight=None)
UpdateWeight bias.UpdateWeight(eta, alpha)
Remove bias.Remove()
Property Example Read/Write
NeuronDst bias.NeuronDst get
Value bias.Value get
Weight bias.Weight get

Using MicroMLP.NNValue static functions :

Name Function
FromPercent nnvalue = MicroMLP.NNValue.FromPercent(value)
NewPercent nnvalue = MicroMLP.NNValue.NewPercent()
FromByte nnvalue = MicroMLP.NNValue.FromByte(value)
NewByte nnvalue = MicroMLP.NNValue.NewByte()
FromBool nnvalue = MicroMLP.NNValue.FromBool(value)
NewBool nnvalue = MicroMLP.NNValue.NewBool()
FromAnalogSignal nnvalue = MicroMLP.NNValue.FromAnalogSignal(value)
NewAnalogSignal nnvalue = MicroMLP.NNValue.NewAnalogSignal()

Using MicroMLP.NNValue class :

Name Function
Constructor nnvalue = MicroMLP.NNValue(minValue, maxValue, value)
Property Example Read/Write
AsFloat nnvalue.AsFloat = 639.513 get / set
AsInt nnvalue.AsInt = 12345 get / set
AsPercent nnvalue.AsPercent = 65 get / set
AsByte nnvalue.AsByte = b'\x75' get / set
AsBool nnvalue.AsBool = True get / set
AsAnalogSignal nnvalue.AsAnalogSignal = 0.39472 get / set

By JC`zic for HC² ;')

Keep it simple, stupid 👍

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].