naiveBayesPredict - 2024.1 English

Vitis Libraries

Release Date
2024.1 English
#include "xf_data_analytics/classification/naive_bayes.hpp"
template <
    int CH_NM,
    int GRP_NM
void naiveBayesPredict (
    const int num_of_class,
    const int num_of_term,
    hls::stream <ap_uint <64>>& i_theta_strm,
    hls::stream <ap_uint <64>>& i_prior_strm,
    hls::stream <ap_uint <32>> i_data_strm [CH_NM],
    hls::stream <bool>& i_e_strm,
    hls::stream <ap_uint <10>>& o_class_strm,
    hls::stream <bool>& o_e_strm

naiveBayesPredict, top function of multinomial Naive Bayes Prediction

The function will firstly load the train model into on-chip memory, and calculate the classfication results for each sample using argmax function.


CH_NM the number of channel for input sample data, should be power of 2
GRP_NM the unroll factor for handling the classes simultaneously, must be power of 2 in 1~256
num_of_term the number of class, should be exactly same with the input dataset
num_of_term the number of feature, should be exactly same with the input dataset
i_theta_strm the input likehood probability stream, [num_of_class][num_of_term]
i_prior_strm the input prior probability stream, [num_of_class]
i_data_strm the input of test data stream
i_e_strm end flag stream for i_data_strm
o_class_strm the prediction result for each input sample
o_e_strm end flag stream for o_class_strm