コード例 #1
0
AppendDataFunctor::AppendDataFunctor(TrainingData::shared_ptr dataStore_)
    : datumIndex(dataStore_->getNumExamples()),
      dataStore(dataStore_)
{
    // nothing to do here
    return;
}
コード例 #2
0
void calcMinMaxFeatureResponses(TrainingData::shared_ptr trainData, MinOrMaxFeaturesResponsesSharedPointer minvs,
                                MinOrMaxFeaturesResponsesSharedPointer maxvs){
    const FeaturesResponses &featuresResponses = trainData->getFeatureResponses();

    for (size_t featureIndex = 0; featureIndex < trainData->getFeaturesPoolSize(); ++featureIndex)
    {
        if (trainData->_validFeatures[featureIndex] == false)
            continue;
        int minv = std::numeric_limits<int>::max();
        int maxv = -std::numeric_limits<int>::max();

        for (size_t exampleIndex = 0; exampleIndex < trainData->getNumExamples(); ++exampleIndex)
        {
            const int val = featuresResponses[featureIndex][exampleIndex];
            minv = std::min(val, minv);
            maxv = std::max(val, maxv);
        } // end of "for each example"

        (*maxvs)[featureIndex] = maxv;
        (*minvs)[featureIndex] = minv;

    } // end of "for each feature"

}