https://github.com/jrhea/anomlee
ANOMLEE: A Neat-O ML EE (pronounced a·nom·a·ly)
https://github.com/jrhea/anomlee
c ethereum machine-learning python rust wasm
Last synced: 12 months ago
JSON representation
ANOMLEE: A Neat-O ML EE (pronounced a·nom·a·ly)
- Host: GitHub
- URL: https://github.com/jrhea/anomlee
- Owner: jrhea
- License: apache-2.0
- Created: 2019-12-06T02:22:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T03:19:18.000Z (over 3 years ago)
- Last Synced: 2025-04-04T22:11:15.757Z (about 1 year ago)
- Topics: c, ethereum, machine-learning, python, rust, wasm
- Language: Jupyter Notebook
- Homepage: anomlee.vercel.app
- Size: 66.4 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## ANOMLEE: A Neat-O Machine Learning Execution Environment
:muscle: by Quilt's [ewasm-rt](https://github.com/quilt/ewasm-rt)
This repo demonstrates how a trained ML model could run inside an Ethereum 2 EE.
## Prerequisits
Install LLVM
```bash
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
```
Install the WebAssembly Binary Toolkit
```bash
brew install wabt
```
Install Python Environment & Dependencies
```
python3 -m venv env
source ./env/bin/activate
pip3 install -r requirements.txt
```
## Build
```bash
make all
```
## Random Forest Classifier (iris model)
This 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)
**Benchmarks:**
- **Python:** 103307 microseconds
- **eWasm:** 551.849 microseconds
- **C:** 1 microsecond
**Binary size:**
- 826 bytes
## Handwritten Digit Classifier (digit model)
This model uses a sequential neural network model to classify handwritten digits from the MINST database
> TODO: finish
## Run Benchmarks (all models)
```bash
$ make benchmark
########## Python Benchmark: ###########
Execution time: 103307 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/anomlee-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
```