Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
remove skbayes.RVC dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
agrimagsrl committed Jun 14, 2020
1 parent aea8a9b commit 0bac123
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ setup.cfg
setup.py
micromlgen/__init__.py
micromlgen/micromlgen.py
micromlgen/patches.py
micromlgen/platforms.py
micromlgen/utils.py
micromlgen/templates/classmap.jinja
micromlgen/templates/testset.jinja
micromlgen/templates/pca/pca.jinja
micromlgen/templates/rvm/rvm.jinja
micromlgen/templates/svm/svm.jinja
micromlgen/templates/svm/computations/class.jinja
Expand Down
5 changes: 4 additions & 1 deletion micromlgen/micromlgen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from skbayes.rvm_ard_models import RVC
from sklearn.svm import SVC, LinearSVC, OneClassSVM
from sklearn.decomposition import PCA
try:
from skbayes.rvm_ard_models import RVC
except ImportError:
from micromlgen.patches import RVC

from micromlgen import platforms
from micromlgen.utils import jinja
Expand Down
3 changes: 3 additions & 0 deletions micromlgen/patches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class RVC:
"""Patch un-installed skbayes RVC classifier"""
pass
4 changes: 2 additions & 2 deletions micromlgen/templates/classmap.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* Convert class idx to readable name
*/
const char* classIdxToName(uint8_t classIdx) {
switch (classIdx) {
const char* predictLabel(float *x) {
switch (predict(x)) {
{% for idx, name in classmap.items() %}
case {{ idx }}:
return "{{ name }}";
Expand Down
2 changes: 1 addition & 1 deletion micromlgen/templates/svm/kernel/arduino.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compute kernel between feature vector and support vector.
* Kernel type: {{ kernel['type'] }}
*/
float compute_kernel(float x[{{ sizes.features }}], ...) {
float compute_kernel(float *x, ...) {
va_list w;
va_start(w, {{ sizes.features }});

Expand Down
2 changes: 1 addition & 1 deletion micromlgen/templates/svm/kernel/attiny.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compute kernel between feature vector and support vector.
* Kernel type: {{ kernel['type'] }}
*/
float compute_kernel(float x[{{ sizes.features }}], float w[{{ sizes.features }}]) {
float compute_kernel(float *x, float w[{{ sizes.features }}]) {
va_list w;
va_start(w, {{ sizes.features }});

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
setup(
name = 'micromlgen',
packages = ['micromlgen'],
version = '1.1.0',
version = '1.1.1',
license='MIT',
description = 'Generate C code for microcontrollers from Python\'s sklearn classifiers',
author = 'Simone Salerno',
author_email = '[email protected]',
url = 'https://github.com/eloquentarduino/micromlgen',
download_url = 'https://github.com/eloquentarduino/micromlgen/archive/v_11.tar.gz',
download_url = 'https://github.com/eloquentarduino/micromlgen/archive/v_111.tar.gz',
keywords = [
'ML',
'microcontrollers',
Expand Down

0 comments on commit 0bac123

Please sign in to comment.