SkillAgentSearch skills...

MaxBDT

No description available

Install / Use

/learn @thesps/MaxBDT
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

A Boosted Decision Tree for Maxeler Dataflow Engines

Example Project

To get started with the example, first:

cd CPUCode
python example_train.py

This creates a dummy dataset, and trains a BDT to classify it using sklearn. The BDT is written to bdt.pkl so we can use it again in python, and bdtjson.txt so we can generate a DFE implementation. Now build the DFE project:

cd RunRules/<Simulation,Maia>
make build

Create the SLiC skin:

sliccompile -t python -m maxfiles/DFEBDT.max
mv DFEBDT.py _DFEBDT.so simutils/ ../../CPUCode

Compare the sklearn GradientBoostingClassifier.decision_function output to the DFE, over the whole dataset feature range (as in the sklearn example):

cd CPUCode
python example_test.py

DFE/sklearn decision contour

Custom Project

To make your own low latency BDT predictions, first of all train a BDT with sklearn, and write the JSON file:

import bdtToJSON

myBDT = GradientBoostingClassifier()
myBDT.fit(myTrainX, myTrainY)
with open('mybdtjson.txt', 'w') as f:
  f.write(bdtToJSON.toJSON(myBDT))

Modify EngineCode/src/BDTManager.maxj to point to your JSON file. You may also want to change the data type of the features and score in the same file.

Dependencies

The maxj project requires json-simple and maxpower. Running the example additionally requires python libraries sklearn, numpy, matplotlib, json.

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated12mo ago
Forks0

Languages

Python

Security Score

62/100

Audited on Apr 12, 2025

No findings