@Override public int size() { return v.size(); }
public static Solution lanczos(VectorFunction<Double, Double> A, final Vector<Double> w) { return lanczos(A, w, w.size(), 1.0); }
public static double diceCoefficient(Vector<Integer> vec1, Vector<Integer> vec2, final StopWordList stopWordList) { final int v1sum = vec1.size(); final int v2sum = vec2.size(); if (v1sum == 0 || v2sum == 0) { return 0; } int v12 = 0; for (Integer i : vec1.keySet()) { if (stopWordList.contains(i)) { continue; } if (vec2.containsKey(i)) { v12++; } } return 2.0 * (double) v12 / (v1sum + v2sum); }
if (defaultValue == 0 || y.defaultValue().intValue() == 0) { int innerProduct = 0; if (this.size() <= y.size()) { for (Map.Entry<Integer, Integer> e : entrySet()) { innerProduct += e.getValue() * y.intValue(e.getKey());
if (defaultValue == 0.0 || y.defaultValue().doubleValue() == 0.0) { double innerProduct = 0.0; if (this.size() <= y.size()) { for (Map.Entry<Integer, Double> e : entrySet()) { innerProduct += e.getValue().doubleValue() * y.doubleValue(e.getKey());
public static double dfDiceCoefficient(Vector<Integer> vec1, Vector<Integer> vec2, Vector<Double> df, final StopWordList stopWordList) { double num = 0.0, denom = 0.0; for (Integer i : vec1.keySet()) { if (stopWordList.contains(i)) { continue; } if (i >= df.size()) { continue; } if (vec2.containsKey(i)) { num += (1.0 - df.doubleValue(i)); } denom += (1.0 - df.doubleValue(i)); } for (int i : vec2.keySet()) { if (stopWordList.contains(i)) { continue; } if (i >= df.size()) { continue; } denom += (1.0 - df.doubleValue(i)); } return denom == 0.0 ? 0.0 : (2.0 * num / denom); }
public static double dfJaccardCoefficient(Vector<Integer> vec1, Vector<Integer> vec2, Vector<Double> df, final StopWordList stopWordList) { double num = 0.0, denom = 0.0; for (Integer i : vec1.keySet()) { if (stopWordList.contains(i)) { continue; } if (i >= df.size()) { continue; } if (vec2.containsKey(i)) { num += (1.0 - df.doubleValue(i)); } if (!vec2.containsKey(i)) { denom += (1.0 - df.doubleValue(i)); } } for (int i : vec2.keySet()) { if (stopWordList.contains(i)) { continue; } if (i >= df.size()) { continue; } denom += (1.0 - df.doubleValue(i)); } return denom == 0.0 ? 0.0 : num / denom; }
if (trivialEigenCols[i]) { final Vector<N> row = A.row(i); if (row.size() == 1) { for (Map.Entry<Integer, N> e : row.entrySet()) { if (e.getValue().doubleValue() != 0.0) {
public static Solution lanczos(VectorFunction<Double, Double> A, final Vector<Double> w, int K, double rho) { final int n = w.size(); assert (K <= n); if (n == 0) {