Skip to main content

Naive Bayes classifier for embedded systems

Project description

# embayes Bayesian machine learning classifiers for embedded systems. Train in Python, deploy on microcontroller.

## Key features

Embedded-friendly Classifier

  • Portable C99 code
  • No stdlib required
  • No dynamic allocations
  • Integer/fixed-point math only
  • Single header file include
  • Fast, sub-millisecond classification

Convenient Training

  • API-compatible with [scikit-learn](
  • Implemented in Python 3
  • C classifier accessible in Python using pybind11

[MIT licensed](./

## Status Minimally useful

  • Gaussian Naive Bayes classifier implemented
  • Tested running on ESP8266 and Linux.
  • On ESP8266, 2 classes and 30 features classify in under 0.5ms

## Installing

Install from git

git clone python3 install –user

## Usage

See [examples/](./examples/ and [embayes.ino](./embayes.ino)



  • Make estimator a wrapper around sklearn.naivebayes.GaussianNB
  • Make estimator work in sklearn pipeline
  • Make pdf approximation configurable as parameter


  • Support generating inline C code, not needing model coefficients in RAM
  • Support de/serializing coefficients at runtime
  • Support training on microcontroller

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for embayes, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size embayes-0.1.1.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page