This repository was archived by the owner on May 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +40
-4
lines changed Expand file tree Collapse file tree 5 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ micromlgen/platforms.py
8
8
micromlgen/utils.py
9
9
micromlgen/templates/classmap.jinja
10
10
micromlgen/templates/testset.jinja
11
+ micromlgen/templates/trainset.jinja
11
12
micromlgen/templates/pca/pca.jinja
12
13
micromlgen/templates/rvm/rvm.jinja
13
14
micromlgen/templates/svm/svm.jinja
Original file line number Diff line number Diff line change 1
1
import micromlgen .platforms as platforms
2
2
from micromlgen .micromlgen import port
3
- from micromlgen .utils import port_testset
3
+ from micromlgen .utils import port_testset , port_trainset
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+
3
+ namespace Eloquent {
4
+ namespace ML {
5
+ namespace Train {
6
+
7
+ /**
8
+ * A tailor made training set
9
+ */
10
+ class {{ classname }} {
11
+ public:
12
+ {{ classname }}() :
13
+ _x{ {% for x in X %}
14
+ { {% for xi in x %} {% if loop .index > 1 %} , {% endif %} {{ f.round(xi) }} {% endfor %} },
15
+ {% endfor %}
16
+ },
17
+ _y{ {% for yi in y %} {% if loop .index > 1 %} , {% endif %} {{ f.round(yi) }} {% endfor %} }
18
+ {}
19
+
20
+ template<class Classifier >
21
+ void fit(Classifier clf) {
22
+ clf.fit(_x, _y, {{ X|length }});
23
+ }
24
+
25
+ protected:
26
+ float _x[{{ X|length }}][{{ X[0] |length }}];
27
+ int _y[{{ X|length }}];
28
+ };
29
+ }
30
+ }
31
+ }
Original file line number Diff line number Diff line change @@ -46,5 +46,9 @@ def jinja(template_file, data):
46
46
return prettify (code )
47
47
48
48
49
+ def port_trainset (X , y , classname = 'TrainSet' ):
50
+ return jinja ('trainset.jinja' , locals ())
51
+
52
+
49
53
def port_testset (X , y , classname = 'TestSet' ):
50
- return jinja ('testset.jinja' , locals ())
54
+ return jinja ('testset.jinja' , locals ())
Original file line number Diff line number Diff line change 7
7
setup (
8
8
name = 'micromlgen' ,
9
9
packages = ['micromlgen' ],
10
- version = '1.1.1 ' ,
10
+ version = '1.1.3 ' ,
11
11
license = 'MIT' ,
12
12
description = 'Generate C code for microcontrollers from Python\' s sklearn classifiers' ,
13
13
author = 'Simone Salerno' ,
14
14
author_email = 'eloquentarduino@gmail.com' ,
15
15
url = 'https://github.com/eloquentarduino/micromlgen' ,
16
- download_url = 'https://github.com/eloquentarduino/micromlgen/archive/v_111 .tar.gz' ,
16
+ download_url = 'https://github.com/eloquentarduino/micromlgen/archive/v_113 .tar.gz' ,
17
17
keywords = [
18
18
'ML' ,
19
19
'microcontrollers' ,
You can’t perform that action at this time.
0 commit comments