template class xf::data_analytics::classification::logisticRegressionPredict¶
#include "logisticRegression.hpp"
Overview¶
linear least square regression predict
Parameters:
MType | datatype of regression, support double and float |
D | Number of features that processed each cycle |
DDepth | DDepth * D is max feature numbers supported. |
K | Number of weight vectors that processed each cycle |
KDepth | KDepth * K is max weight vectors supported. |
RAMWeight | Use which kind of RAM to store weight, could be LUTRAM, BRAM or URAM. |
RAMIntercept | Use which kind of RAM to store intercept, could be LUTRAM, BRAM or URAM. |
template < typename MType, int D, int DDepth, int K, int KDepth, RAMType RAMWeight, RAMType RAMIntercept > class logisticRegressionPredict // fields static const int marginDepth sl2 <MType, D, DDepth, K, KDepth,&funcMul <MType>,&funcSum <MType>,&funcAssign <MType>, AdditionLatency <MType>::value, RAMWeight, RAMIntercept> marginProcessor pickMaxProcess <MType, K> pickProcessor
Methods¶
pickFromK¶
void pickFromK ( MType margin [K], ap_uint <32> counter, ap_uint <32> ws, MType& maxMargin, ap_uint <32>& maxIndex )
pick best weight vector for classification from K vectors
Parameters:
margin | K margins generate by K weight vectors. |
counter | start index of this K margins in all margins. |
ws | number of margins |
maxMargin | max of K margins. |
maxIndex | which index does max margin sits. |
pick¶
void pick ( hls::stream <MType> marginStrm [K], hls::stream <bool>& eMarginStrm, hls::stream <ap_uint <32>>& retStrm, hls::stream <bool>& eRetStrm, ap_uint <32> ws )
pick best weight vector for classification
Parameters:
marginStrm | margin stream. To get a vector of L margins, marginStrm will be read (L + K - 1) / D times. Margin 0 to K-1 will be read from marginStrm[0] to marginStrm[D-1] at the first time. Then margin D to 2*D - 1. The last round will readin fake data if L is not divisiable by K. These data won’t be used, just to allign K streams. |
eMarginStrm | Endflag of marginStrm. |
retStrm | result stream of classification. |
eRetStrm | Endflag of retStrm. |
ws | number of weight vectors used. |
predict¶
void predict ( hls::stream <MType> opStrm [D], hls::stream <bool>& eOpStrm, ap_uint <32> cols, ap_uint <32> classNum, hls::stream <ap_uint <32>>& retStrm, hls::stream <bool>& eRetStrm )
classification function of logistic regression
Parameters:
opStrm | feature input streams. To get a vector of L features, opStrm will be read (L + D - 1) / D times. Feature 0 to D-1 will be read from opStrm[0] to opStrm[D-1] at the first time. Then feature D to 2*D - 1. The last round will readin fake data if L is not divisiable by D. These data won’t be used, just to allign D streams. |
eOpStrm | End flag of opStrm. |
cols | Feature numbers |
classNum | Number of classes. |
retStrm | result stream of classification. |
eRetStrm | Endflag of retStrm. |
setWeight¶
void setWeight ( MType inputW [K][D][KDepth *DDepth], ap_uint <32> cols, ap_uint <32> classNum )
set up weight parameters for prediction
Parameters:
inputW | weight |
cols | Effective weight numbers |
classNum | number of classes. |
setIntercept¶
void setIntercept ( MType inputI [K][KDepth], ap_uint <32> classNum )
set up intercept parameters for prediction
Parameters:
inputI | intercept, should be set to zero if don’t needed. |
classNum | number of classes. |