Returns the function value of the approximation line at the specified k.

@param k the value for which the function value of the approximation line
should be returned
@return the function value of the approximation line at the specified k
549507
public double getValueAt(int k) {
    if (k < k_0) {
      return Double.POSITIVE_INFINITY;
    }
    return m * FastMath.log(k) + t;
  }
135886
protected PolynomialApproximation knnDistanceApproximation() {
    int p_max = 0;
    double[] b = null;
    for(int i = 0; i < getNumEntries(); i++) {
      MkAppEntry entry = getEntry(i);
      PolynomialApproximation approximation = entry.getKnnDistanceApproximation();
      if(b == null) {
        p_max = approximation.getPolynomialOrder();
        b = new double[p_max];
      }
      for(int p = 0; p < p_max; p++) {
        b[p] += approximation.getB(p);
      }
    }

    for(int p = 0; p < p_max; p++) {
      b[p] /= p_max;
    }

    if(LoggingConfiguration.DEBUG) {
      StringBuilder msg = new StringBuilder();
      msg.append("b " + FormatUtil.format(b, FormatUtil.NF4));
      Logger.getLogger(this.getClass().getName()).fine(msg.toString());
    }

    return new PolynomialApproximation(b);
  }
258676
public static double kthSmallestValue(int[] array, int k) {

    int[] index = new int[array.length];
    
    for (int i = 0; i < index.length; i++) {
      index[i] = i;
    }

    return array[index[select(array, index, 0, array.length - 1, k)]];
  }
200451
public double computeAverage (Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,SavedState>,Double> function) 
  {
    double sum = 0;
    Iterator<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,SavedState>> foldIt = iterator();
    while (foldIt.hasNext()) {
      sum += function.apply(foldIt.next());
    }
    return sum / kfold;
  }
711313
public double get(double x, double epsilon)
    {
        Point nearest = getNearest(x, epsilon);
        return nearest.getY();
    }
1327850
public static <K, V, P> V getIfAbsentPutWith(
            Map<K, V> map,
            K key,
            Function<? super P, ? extends V> function,
            P parameter)
    {
        V result = map.get(key);
        if (MapIterate.isAbsent(result, map, key))
        {
            result = function.valueOf(parameter);
            map.put(key, result);
        }
        return result;
    }
794936
private double getValue(final double x, final double y, final double z,
            final Axis axis) {
        switch (axis) {
            case X:
                return x;
            case X_INVERTED:
                return -x;
            case Y:
                return y;
            case Y_INVERTED:
                return -y;
            case Z:
                return z;
            case Z_INVERTED:
                return -z;
            default:
                throw new IllegalArgumentException("Unsupported axis.");
        }
    }
1063892
protected ApproximationLine progressiveKnnDistanceApproximation(int k_max) {
    if(!isLeaf()) {
      throw new UnsupportedOperationException("Progressive KNN-distance approximation " + "is only vailable in leaf nodes!");
    }

    // determine k_0, y_1, y_kmax
    int k_0 = 0;
    double y_1 = Double.POSITIVE_INFINITY;
    double y_kmax = Double.POSITIVE_INFINITY;

    for(int i = 0; i < getNumEntries(); i++) {
      MkCoPLeafEntry entry = (MkCoPLeafEntry) getEntry(i);
      ApproximationLine approx = entry.getProgressiveKnnDistanceApproximation();
      k_0 = Math.max(approx.getK_0(), k_0);
    }

    for(int i = 0; i < getNumEntries(); i++) {
      MkCoPLeafEntry entry = (MkCoPLeafEntry) getEntry(i);
      ApproximationLine approx = entry.getProgressiveKnnDistanceApproximation();
      y_1 = Math.min(approx.getValueAt(k_0), y_1);
      y_kmax = Math.min(approx.getValueAt(k_max), y_kmax);
    }

    // determine m and t
    double m = (y_kmax - y_1) / (FastMath.log(k_max) - FastMath.log(k_0));
    double t = y_1 - m * FastMath.log(k_0);

    return new ApproximationLine(k_0, m, t);
  }
769218
public Object getFunctionsValue(String parameter, String function){
        
        Object value=null;
        return value;
    }
1121405
private double joint(int k, int y[]) {
        double p = 1.0; //priors[k];
        for (int j = 0; j < y.length; j++) {
            if (j != k && y[j] == 1) {
                p *= Conditional[k][j];
            }
        }
        return p;
    }
28422
public synchronized String findValue(String k) {
        if (k == null) {
            for (int i = nkeys; --i >= 0;)
                if (keys[i] == null)
                    return values[i];
        } else
            for (int i = nkeys; --i >= 0;) {
                if (k.equalsIgnoreCase(keys[i]))
                    return values[i];
            }
        return null;
    }
210129
public static <K,V> Function<K,V> lookup(Map<K, V> map) {
        return Functions.forMap(map);
    }
266969
def estimate_k(X, max_k):
    
    ks = range(1, max_k)
    fs = np.zeros(len(ks))

    # Special case K=1
    fs[0], Sk = _fK(1)

    # Rest of Ks
    for k in ks[1:]:
        fs[k-1], Sk = _fK(k, Skm1=Sk)
    return np.argmin(fs) + 1
1257276
public static long binCoeff(int n, int k) {
                if (k > n) {
                        return 0;
                }
                if (k == 0 || k == n) {
                        return 1;
                }
                long result = 1;
                for (int i = 1; i <= k; i++) {
                        result *= (n - i + 1) / i;
                }
                return result;
        }
147644
public final Set<V> getValues(K key) {
	Set<V> set = _getValues(key);
	if(set == null)
	    return Collections.emptySet();
	else 
	    return Collections.unmodifiableSet(set);
    }
169584
public static double approximateBinomialCoefficient(int n, int k) {
    final int m = max(k, n - k);
    long temp = 1;
    for(int i = n, j = 1; i > m; i--, j++) {
      temp = temp * i / j;
    }
    return temp;
  }
247886
private IntIntPair nonZeroPivotSearch(int k) {

    int i, j;
    double absValue;
    for(i = k; i < coeff.length; i++) {
      for(j = k; j < coeff[0].length; j++) {
        // compute absolute value of
        // current entry in absValue
        absValue = Math.abs(coeff[row[i]][col[j]]);

        // check if absValue is non-zero
        if(absValue > 0) { // found a pivot element
          return new IntIntPair(i, j);
        } // end if
      } // end for j
    } // end for k
    return new IntIntPair(k, k);
  }