Giter Club home page Giter Club logo

anmlee's Introduction

ANMLEE: A Nascent ML EE (pronounced a·nom·a·ly)

!!THIS IS A WORK IN PROGRESS!!

This repo demonstrates how a trained ML model could run inside an Ethereum 2 EE. Currently there is a single random forest classifier model that is trained to determine which of the following types of iris flowers:

  • setosa
  • versicolor
  • virginica

based on the following design variables:

  • sepal length (cm)
  • sepal width (cm)
  • petal length (cm)
  • petal width (cm)

Prerequisits

Install LLVM

brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile

Install the WebAssembly Binary Toolkit

brew install wabt

Install NinJa

brew install ninja

Build

make build

Run Native

$ ./build/random-forest

Execution time: 0 microseconds


Probabilities: 
1.000000 0.000000 0.000000 

Model Predicts: 
setosa    

Run eWASM

$ ./build/anmlee

Probabilities: 
1.0000 .0000 .0000 

Model Predicts: 
setosa    

Run Benchmark

$ make benchmark
########## Python Benchmark: ###########

Execution time:  107772  microseconds.


 0    setosa
Name: species, dtype: category
Categories (3, object): [setosa, versicolor, virginica] 

########## eWasm Benchmark: ###########
    Finished release [optimized] target(s) in 0.03s
     Running target/release/deps/anmlee-0de6000a8c14c88e

running 1 test

Execution Time: 551.849µs

test tests::test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

########## C Benchmark: ##########

Execution time: 1 microseconds


Probabilities: 
1.000000 0.000000 0.000000 

Model Predicts: 
setosa    

Benchmark Results

  • Python: 107772 microseconds
  • eWasm: 551.849 microseconds
  • C: 1 microsecond

anmlee's People

Contributors

jrhea avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

isabella232

anmlee's Issues

remove hard coded path

in main.rs, there is a hard coded path to the generated wasm:

let code = include_bytes!("/Users/jonny/projects/consensys/pegasys/ee/anmlee/build/random-forest.wasm").to_vec();

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.