@@ -10,19 +10,22 @@ without having to touch any C code.
10
10
## Status
11
11
** Minimally useful**
12
12
13
- - Can perform classification with [ RandomForest] ( https://en.wikipedia.org/wiki/Random_forest ) /DecisionTree models
14
- - Installable as a MicroPython native module. No rebuild/flashing needed
15
- - Models can be loaded at runtime from a .CSV file in disk/flash
13
+ - Has been tested on ` armv6m ` (RP2040) and ` x64 ` (Unix port)
16
14
- Pre-built modules are available for the most common architectures/devices
17
- - Has been tested on ` armv6m ` (RP2040) and ` x64 ` (Unix port)
18
15
16
+ ## Features
17
+
18
+ - Classification with [ RandomForest] ( https://en.wikipedia.org/wiki/Random_forest ) /DecisionTree models
19
+ - Classification and on-device learning with [ K-Nearest Neighbors (KNN)] ( https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm )
20
+ - Installable as a MicroPython native module. No rebuild/flashing needed
21
+ - Models can be loaded at runtime from a .CSV file in disk/flash
19
22
20
23
## Prerequisites
21
24
22
25
Minimally you will need
23
26
24
27
- Python 3.10+ on host
25
- - MicroPython running onto your device
28
+ - MicroPython 1.20+ running onto your device
26
29
27
30
#### Download repository
28
31
@@ -57,15 +60,16 @@ Download from [releases](https://github.com/emlearn/emlearn-micropython/releases
57
60
58
61
Copy the .mpy file for the correct ` ARCH ` to your device.
59
62
```
60
- mpremote cp emltrees-$ARCH.mpy :emltrees.mpy
63
+ mpremote cp emltrees.mpy :emltrees.mpy
64
+ mpremote cp emlneighbors.mpy :emlneighbors.mpy
61
65
```
62
66
63
67
NOTE: If there is no ready-made build for your device/architecture,
64
68
then you will need to build the .mpy module yourself.
65
69
66
70
## Usage
67
71
68
- NOTE: Make sure to install the module first.
72
+ NOTE: Make sure to install the module first (see above)
69
73
70
74
Train a model with scikit-learn
71
75
```
@@ -115,24 +119,28 @@ See [MicroPython: Building native modules](https://docs.micropython.org/en/lates
115
119
We assume that micropython is installed in the same place as this repository.
116
120
If using another location, adjust ` MPY_DIR ` accordingly.
117
121
122
+ NOTE: As of August 2023, an out-of-tree patch is needed for MicroPython.
123
+ [ micropython #12123 : mpy_ld.py: Support complex RO sections] ( https://github.com/micropython/micropython/pull/12123 ) .
124
+ This will hopefully be fixed in the coming months.
118
125
119
126
#### Build
120
127
121
128
Build the .mpy native module
122
129
```
123
- make -C eml_trees/ ARCH=x64 MPY_DIR=../ ../micropython
130
+ make dist ARCH=armv6m MPY_DIR=../micropython
124
131
```
125
132
126
133
Install it on device
127
134
```
128
- mpremote cp emltrees /emltrees.mpy :emltrees.mpy
135
+ mpremote cp dist/armv6m* /emltrees.mpy :emltrees.mpy
129
136
```
130
137
131
138
#### Run tests
132
139
133
- ` TODO: implement and document `
134
-
135
-
140
+ To build and run tests on host
141
+ ```
142
+ make check
143
+ ```
136
144
137
145
## Citations
138
146
0 commit comments