Code Monkey home page Code Monkey logo

perceptron-boolean-and's Introduction

perceptron-boolean-and

A basic implementation of logical 'and' in a Perceptron

Setup

$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install -r requirements.txt

Test

$ python3 Perceptron_Test.py

Static Analysis

$ pycodestyle *.py

Loosely based on Thomas Countz' implementation from here: https://gist.github.com/Thomascountz/77670d1fd621364bc41a7094563a7b9c

Sample Output

(base) shirish@***************:workarea/perceptron-boolean-and ‹master*›$
------------------------------------------------------------------------
    x1    x2    LR     t   sum   act   dw1   dw2    db    w1    w2     b
------------------------------------------------------------------------
Epoch-1
     1     1  0.01     1     0     0  0.01  0.01  0.01  0.01  0.01  0.01
     1     0  0.01     0  0.02     1   0.0  0.01   0.0   0.0  0.01   0.0
     0     1  0.01     0  0.01     1   0.0   0.0 -0.01   0.0   0.0 -0.01
     0     0  0.01     0 -0.01     0   0.0   0.0 -0.01   0.0   0.0 -0.01
------------------------------------------------------------------------
    x1    x2    LR     t   sum   act   dw1   dw2    db    w1    w2     b
------------------------------------------------------------------------
Epoch-2
     1     1  0.01     1 -0.01     0  0.01  0.01   0.0  0.01  0.01   0.0
     1     0  0.01     0  0.01     1   0.0  0.01 -0.01   0.0  0.01 -0.01
     0     1  0.01     0   0.0     0   0.0  0.01 -0.01   0.0  0.01 -0.01
     0     0  0.01     0 -0.01     0   0.0  0.01 -0.01   0.0  0.01 -0.01

...

Epoch-99
     1     1  0.01     10.009999999999999998     1  0.01  0.02 -0.02  0.01  0.02 -0.02
     1     0  0.01     0 -0.01     0  0.01  0.02 -0.02  0.01  0.02 -0.02
     0     1  0.01     0   0.0     0  0.01  0.02 -0.02  0.01  0.02 -0.02
     0     0  0.01     0 -0.02     0  0.01  0.02 -0.02  0.01  0.02 -0.02
------------------------------------------------------------------------
    x1    x2    LR     t   sum   act   dw1   dw2    db    w1    w2     b
------------------------------------------------------------------------
Epoch-100
     1     1  0.01     10.009999999999999998     1  0.01  0.02 -0.02  0.01  0.02 -0.02
     1     0  0.01     0 -0.01     0  0.01  0.02 -0.02  0.01  0.02 -0.02
     0     1  0.01     0   0.0     0  0.01  0.02 -0.02  0.01  0.02 -0.02
     0     0  0.01     0 -0.02     0  0.01  0.02 -0.02  0.01  0.02 -0.02



evaluate    1   1 , result:  (1, 0.009999999999999998)
evaluate    0   1 , result:  (0, 0.0)
evaluate    1   0 , result:  (0, -0.01)
evaluate    0   0 , result:  (0, -0.02)
.
----------------------------------------------------------------------
Ran 1 test in 0.329s

OK

perceptron-boolean-and's People

Contributors

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