Skip to content

Creating Logic Functions [AND, OR, NOT, XNOR, XOR, NAND, etc] using Neural Network

Notifications You must be signed in to change notification settings

fjcamillo/Neural-Representation-of-Logic-Functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

Representing Logic Gates using a Neural Network

How to use

In the example below we've created a simple Logic And using our class

>>> from neurallogic import Neural
>>> bias = -0.2
>>> weights = [-0.1 , 0.2, 0.2]
>>> import numpy as np
>>> dataset = np.array([
...     [1,0,0],
...     [1,0,1],
...     [1,1,0],
...     [1,1,1]
... ])
>>> neural = Neural(weights, bias, dataset)
>>> neural.logit
array([[0.42555748],
       [0.47502081],
       [0.47502081],
       [0.52497919]])
>>> neural.__converted__()
array([[0.],
       [0.],
       [0.],
       [1.]])

Here's another example in creating a simple Logic Or using our class

>>> from neurallogic import Neural
>>> import numpy as np
>>> bias = -0.1
>>> weights = [-0.1, 0.7,0.7]
>>> dataset = np.array([
...     [1,0,0],
...     [1,0,1],
...     [1,1,0],
...     [1,1,1]
... ])
>>> neural = Neural(weights, bias, dataset)
>>> neural.logit
array([[0.450166  ],
       [0.62245933],
       [0.62245933],
       [0.76852478]])
>>> neural.__converted__()
array([[0.],
       [1.],
       [1.],
       [1.]])
>>> 

About

Creating Logic Functions [AND, OR, NOT, XNOR, XOR, NAND, etc] using Neural Network

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages