naiveBayesTrain - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English
#include "xf_data_analytics/classification/naive_bayes.hpp"
template <
    int DT_WIDTH = 32,
    int WL = 3,
    typename DT = unsigned int
    >
void naiveBayesTrain (
    const int num_of_class,
    const int num_of_term,
    hls::stream <ap_uint <64>> i_data_strm [1<< WL],
    hls::stream <bool> i_e_strm [1<< WL],
    hls::stream <int>& o_terms_strm,
    hls::stream <ap_uint <64>> o_data0_strm [1<< WL],
    hls::stream <ap_uint <64>> o_data1_strm [1<< WL]
    )

naiveBayesTrain, top function of multinomial Naive Bayes Training.

This function will firstly load train dataset from the i_data_strm, then counte the frequency for each hit term. After scaning all sample, the likehood probability matrix and prior probability will be output from two independent stream

Parameters:

DT_WIDTH the width of type DT, in bits
WL the width of bit to enable dispatcher, only 3 is supported so far
DT the data type of internal counter for terms, can be 32/64-bit integer, float or double
num_of_class the number of class in sample dataset, should be exactly same with real dataset
num_of_term the number of terms, must be larger than the number of feature, and num_of_class * num_of_term <= (1 << (20-WL)) must be satisfied.
i_data_strm input data stream of ap_uint<64> in multiple channel
i_e_strm end flag stream for each input data channel
o_terms_strm the output number of statistic feature
o_data0_strm the output likehood matrix
o_data1_strm the output prior probablity vector