Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Commit

Permalink
fix setup
Browse files Browse the repository at this point in the history
  • Loading branch information
agrimagsrl committed Nov 28, 2019
1 parent 9989cdc commit 4e96f5e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

Binary file added micromlgen/__pycache__/micromlgen.cpython-36.pyc
Binary file not shown.
7 changes: 5 additions & 2 deletions micromlgen/micromlgen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
from math import factorial
from jinja2 import FileSystemLoader, Environment
Expand Down Expand Up @@ -26,8 +27,10 @@ def port(clf, test_set=None, classmap=None, **kwargs):
'enumerate': enumerate,
}
}
loader = FileSystemLoader('.')
template = Environment(loader=loader).get_template('./templates/svm.jinja')
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
loader = FileSystemLoader(dir_path + '/templates')
template = Environment(loader=loader).get_template('svm.jinja')
code = template.render(template_data)
code = re.sub(r'\n\s*\n', '\n', code)

Expand Down
16 changes: 8 additions & 8 deletions micromlgen/templates/svm.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

{% include 'templates/kernel_function.jinja' %}
{% include 'kernel_function.jinja' %}

/**
* Predict class for features vector
Expand All @@ -10,16 +10,16 @@ int predict(double *x) {
double decisions[{{ DECISIONS_COUNT }}] = { 0 };
int votes[{{ CLASSES_COUNT }}] = { 0 };

{% include 'templates/compute_kernels.jinja' %}
{% include 'compute_kernels.jinja' %}

{% if CLASSES_COUNT == 2 %}
{% include 'templates/binary_classification.jinja' %}
{% include 'binary_classification.jinja' %}
{% else %}
{% include 'templates/compute_decisions.jinja' %}
{% include 'templates/compute_votes.jinja' %}
{% include 'templates/compute_class.jinja' %}
{% include 'compute_decisions.jinja' %}
{% include 'compute_votes.jinja' %}
{% include 'compute_class.jinja' %}
{% endif %}
}

{% include 'templates/self_test.jinja' %}
{% include 'templates/classmap.jinja' %}
{% include 'self_test.jinja' %}
{% include 'classmap.jinja' %}
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
setup(
name = 'micromlgen',
packages = ['micromlgen'],
version = '0.4',
version = '0.5',
license='MIT',
description = 'Generate C code for microcontrollers from Python\'s sklearn classifiers',
author = 'Simone Salerno',
author_email = '[email protected]',
url = 'https://github.com/agrimagsrl/micromlgen',
download_url = 'https://github.com/agrimagsrl/micromlgen/archive/v_04.tar.gz',
download_url = 'https://github.com/agrimagsrl/micromlgen/archive/v_05.tar.gz',
keywords = ['ML', 'microcontrollers', 'sklearn', 'machine learning'],
install_requires=[
'jinja2',
],
'jinja2',
],
package_data= {
'micromlgen': ['templates/*.jinja']
},
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
Expand Down

0 comments on commit 4e96f5e

Please sign in to comment.