本文整理汇总了C++中TimeSeries::setSegLst方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSeries::setSegLst方法的具体用法?C++ TimeSeries::setSegLst怎么用?C++ TimeSeries::setSegLst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSeries
的用法示例。
在下文中一共展示了TimeSeries::setSegLst方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evalKer
/* ********************************************************** *
* Evaluate the detection score function of a window of frames *
* *********************************************************** */
int evalKer(Eigen::MatrixXd Ds, TimeSeries TS, Eigen::MatrixXd w, double b, int minSegLen, int maxSegLen, int segStride, int d, int sd, int featType, double thresh)
{
int n = Ds.cols();
double minth = -125.803;
double maxth = 130.957;
if ((minSegLen < 1) || (maxSegLen < minSegLen) || (segStride < 1))
std::cout << "crtFeatWindow: evalKer: invalid option for sOpt";
if (minSegLen > n)
std::cout << "crtFeatWindow: evalKer: minimum segment length is greater than the time series length" << std::endl;
if (maxSegLen > n)
maxSegLen = n;
//Time series options
TS.D = Ds.data();
TS.n = n;
if (featType == FEAT_BAG) {
TS.IntD = new double[d*(n + 1)];
cmpIntIm(TS.D, d, n, TS.IntD);
}
else if (featType == FEAT_ORDER) {
TS.sd = sd;
}
TS.setSegLst(minSegLen, maxSegLen, segStride);
TS.updateSegLstVals(w.data(), b);
//Event mxEv;
double mxVal = -std::numeric_limits<double>::infinity();
int curIdx = 0, segLstSz = TS.segLst.size();
for (int t = minSegLen; t<n; t++) {
if (curIdx < segLstSz) { // there are more segments to consider
ExEvent curSeg = TS.segLst[curIdx];
while (curSeg.e <= t) {
mxVal = curSeg.val;
//Detect the Event (if detect score sup to a threshold)
if (mxVal > thresh) {
//std::cout<<"sortie "<<mxVal << " > " <<thresh <<std::endl;
return 0;
}
curIdx++;
if (curIdx >= segLstSz)
break;
curSeg = TS.segLst[curIdx];
}
}
}
//std::cout << "crtFeatWindow: evalKer: No event was found" << std::endl;
return -1;
}