namespace clustering¶
// namespaces namespace xf::data_analytics::clustering::internal
kMeansPredict¶
#include "xf_DataAnalytics/clustering/kmeansPredict.hpp"
template < typename DT, int Dim, int Kcluster, int uramDepth, int KU, int DV > void kMeansPredict ( hls::stream <ap_uint <sizeof (DT)*8>> sampleStrm [DV], hls::stream <bool>& endSampleStrm, ap_uint <sizeof (DT)*8*DV> centers [KU][uramDepth], const int dims, const int kcluster, hls::stream <ap_uint <32>>& tagStrm, hls::stream <bool>& endTagStrm )
kMeansPredict predicts cluster index for each sample. In order to achive to acceleration, please make sure partition 1-dim of centers.
Parameters:
| DT | data type, supporting float and double |
| Dim | the maximum number of dimensions,dynamic number of dimension should be not greater than the maximum. |
| Kcluster | the maximum number of cluster,dynamic number of cluster should be not greater than the maximum. |
| uramDepth | the depth of uram where centers are stored. uramDepth should be not less than ceiling(Kcluster/KU)
|
| KU | unroll factor of Kcluster, KU centers are took part in calculating distances concurrently with one sample. After Kcluster/KU+1 times at most, ouput the minimum distance of a sample and Kcluster centers. |
| DV | unroll factor of Dim, DV elements in a center are took part in calculating distances concurrently with one sample. |
| sampleStrm | input sample streams, a sample needs ceiling(dims/DV) times to read. |
| endSampleStrm | the end flag of sample stream. |
| centers | an array stored centers, user should partition dim=1 in its defination. |
| dims | the number of dimensions. |
| kcluster | the number of clusters. |
| tagStrm | tag stream, label a cluster ID for each sample. |
| endTagStrm | end flag of tag stream. |