Skip to content

Commit ce73848

Browse files
committed
linreg: Start of module for ElasticNet linear regression
1 parent fb418c9 commit ce73848

4 files changed

Lines changed: 431 additions & 0 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ $(MODULES_PATH)/emlearn_iir_q15.mpy:
5555
$(MODULES_PATH)/emlearn_arrayutils.mpy:
5656
make -C src/emlearn_arrayutils/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean dist
5757

58+
$(MODULES_PATH)/emlearn_linreg.mpy:
59+
make -C src/emlearn_linreg/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean dist
60+
5861
emlearn_trees.results: $(MODULES_PATH)/emlearn_trees.mpy
5962
MICROPYPATH=$(MODULES_PATH) $(MICROPYTHON_BIN) tests/test_trees.py
6063

@@ -79,6 +82,9 @@ emlearn_iir_q15.results: $(MODULES_PATH)/emlearn_iir_q15.mpy
7982
emlearn_arrayutils.results: $(MODULES_PATH)/emlearn_arrayutils.mpy
8083
MICROPYPATH=$(MODULES_PATH) $(MICROPYTHON_BIN) tests/test_arrayutils.py
8184

85+
emlearn_linreg.results: $(MODULES_PATH)/emlearn_linreg.mpy
86+
MICROPYPATH=$(MODULES_PATH) $(MICROPYTHON_BIN) tests/test_linreg.py
87+
8288
$(PORT_DIR):
8389
mkdir -p $@
8490

src/emlearn_linreg/Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Location of top-level MicroPython directory
2+
MPY_DIR = ../../micropython
3+
4+
# Architecture to build for (x86, x64, armv6m, armv7m, xtensa, xtensawin)
5+
ARCH = x64
6+
7+
# The ABI version for .mpy files
8+
MPY_ABI_VERSION := 6.3
9+
10+
# Location of emlearn library
11+
EMLEARN_DIR := $(shell python3 -c "import emlearn; print(emlearn.includedir)")
12+
13+
# enable linking of libm etc
14+
LINK_RUNTIME=1
15+
16+
DIST_DIR := ../../dist/$(ARCH)_$(MPY_ABI_VERSION)
17+
18+
# Name of module
19+
MOD = emlearn_linreg
20+
21+
# Source files (.c or .py)
22+
SRC = linreg.c
23+
24+
# Include to get the rules for compiling and linking the module
25+
include $(MPY_DIR)/py/dynruntime.mk
26+
27+
# Releases
28+
DIST_FILE = $(DIST_DIR)/$(MOD).mpy
29+
$(DIST_DIR):
30+
mkdir -p $@
31+
32+
$(DIST_FILE): $(MOD).mpy $(DIST_DIR)
33+
cp $< $@
34+
35+
CFLAGS += -I$(EMLEARN_DIR) -Wno-unused-function
36+
37+
dist: $(DIST_FILE)

0 commit comments

Comments
 (0)