namespace internal¶
// classes template < typename MType, int WAxi, int WData, int BurstLen, int D, int DDepth, RAMType RAMWeight, RAMType RAMIntercept, RAMType RAMAvgWeight, RAMType RAMAvgIntercept > class LASSORegressionSGDTrainer template < typename MType, int D > class linearLeastSquareGradient template < typename MType, int WAxi, int WData, int BurstLen, int D, int DDepth, RAMType RAMWeight, RAMType RAMIntercept, RAMType RAMAvgWeight, RAMType RAMAvgIntercept > class linearLeastSquareGradientProcessor template < typename MType, int WAxi, int WData, int BurstLen, int D, int DDepth, RAMType RAMWeight, RAMType RAMIntercept, RAMType RAMAvgWeight, RAMType RAMAvgIntercept > class linearLeastSquareRegressionSGDTrainer template < typename MType, int WAxi, int WData, int BurstLen, int D, int DDepth, RAMType RAMWeight, RAMType RAMIntercept, RAMType RAMAvgWeight, RAMType RAMAvgIntercept > class ridgeRegressionSGDTrainer
predictFun¶
#include "xf_data_analytics/regression/decision_tree_predict.hpp"
template < typename MType, unsigned WD, unsigned MAX_FEA_NUM, unsigned MAX_TREE_DEPTH > void predictFun ( ap_uint <WD> onesample [MAX_FEA_NUM], struct NodeR <MType> nodes [(MAX_TREE_DEPTH+1)/2+1][MAX_NODES_NUM], MType& reg_value )
predictFun implements the detailed predict functions.
This function read one sample, and output a category id
Parameters:
MType | The data type of sample |
WD | The width of data type MType, can get by sizeof(MType) |
MAX_FEA_NUM | Max feature num function can support |
MAX_TREE_DEPTH | Max tree depth function can support |
onesample | One sample |
nodes | Decision tree (Decision Tree node array) |
cat_id | Category id |
getPredictions¶
#include "xf_data_analytics/regression/decision_tree_predict.hpp"
template < typename MType, unsigned WD, unsigned MAX_FEA_NUM, unsigned MAX_TREE_DEPTH > void getPredictions ( hls::stream <ap_uint <WD>> dstrm_batch [MAX_FEA_NUM], hls::stream <bool>& estrm_batch, struct NodeR <MType> nodes [(MAX_TREE_DEPTH+1)/2+1][MAX_NODES_NUM], hls::stream <MType>& predictionsStrm, hls::stream <bool>& predictionsTag )
getPredictions wrap predictFun to implement batch samples predicion.
This function read sample streams, and output prediction result into a stream
Parameters:
MType | The data type of sample |
WD | The width of data type MType, can get by sizeof(MType) |
MAX_FEA_NUM | Max feature num function can support |
MAX_TREE_DEPTH | Max tree depth function can support |
dstrm_batch | Input data streams of ap_uint<WD> |
estrm_batch | End flag stream for input data |
nodes | Decision tree (Decision Tree node array) |
predictionsStrm | Output data streams |
predictionsTagStrm | End flag stream for output |
getTree¶
#include "xf_data_analytics/regression/decision_tree_predict.hpp"
template < typename MType, unsigned MAX_TREE_DEPTH > void getTree ( hls::stream <ap_uint <512>>& tree_strm, hls::stream <bool>& eTag, struct NodeR <MType> nodes [(MAX_TREE_DEPTH+1)/2+1][MAX_NODES_NUM] )
getTree loads 512-bit decision tree into a list of NodeR
Note that nodes is duplicated (max_tree_depth+1)/2+1 times for unroll each tree layer in getPredictions.
Parameters:
MType | The data type of sample |
MAX_TREE_DEPTH | Max tree depth function can support |
tree_strm | Decision tree streams |
eTag | End flag stream for decision tree nodes |
nodes | Decision tree (Decision Tree node array) |