Exemplo n.º 1
0
int ThresholdCurve::getThresholdInstance(Instances &tcurve, const double threshold) {

    if (RELATION_NAME != tcurve.getRelationName() || (tcurve.numInstances() == 0) || (threshold < 0) || (threshold > 1.0)) {
        return -1;
    }
    if (tcurve.numInstances() == 1) {
        return 0;
    }
    double_array tvals = tcurve.attributeToDoubleArray(tcurve.numAttributes() - 1);
    int_array sorted = Utils::Sort(tvals);
    return binarySearch(sorted, tvals, threshold);
}