public static final int[] sort(int a[]) { int c[] = Arrays.copyOf(a,a.length); Utils.sort(c); // @todo: Arrays.sort ? return c; }
public static final int[] sort(int a[]) { int c[] = Arrays.copyOf(a,a.length); Utils.sort(c); // @todo: Arrays.sort ? return c; }
public static final Instance deleteAttributesAt(Instance x, int indicesToRemove[]) {//, boolean keep) { Utils.sort(indicesToRemove); for(int j = indicesToRemove.length-1; j >= 0; j--) { x.deleteAttributeAt(indicesToRemove[j]); } return x; }
public static final Instances deleteAttributesAt(Instances D, int indicesToRemove[]) {//, boolean keep) { Utils.sort(indicesToRemove); for(int j = indicesToRemove.length-1; j >= 0; j--) { D.deleteAttributeAt(indicesToRemove[j]); } return D; }
/** * Rank Matrix */ public static int[][] rankMatrix(List<EvaluationStatistics> stats, String measurement) { double V[][] = valueMatrix(stats,measurement); int N = V.length; int k = V[0].length; int R[][] = new int[N][k]; for (int i = 0; i < N; i++) { int indices[] = Utils.sort(V[i]); // add 1 to each for (int j = 0; j < k; j++) { R[i][indices[j]] = (j+1); } } return R; }
/** * Rank Matrix */ public static int[][] rankMatrix(List<EvaluationStatistics> stats, String measurement) { double V[][] = valueMatrix(stats,measurement); int N = V.length; int k = V[0].length; int R[][] = new int[N][k]; for (int i = 0; i < N; i++) { int indices[] = Utils.sort(V[i]); // add 1 to each for (int j = 0; j < k; j++) { R[i][indices[j]] = (j+1); } } return R; }
/** * Check whether the two integer vectors equal to each other Two integer * vectors are equal if all the elements are the same, regardless of the * order of the elements * * @param b another integer vector * @return whether they are equal */ private boolean equal(DynamicIntArray b) { if ((b == null) || (size() != b.size())) { return false; } int size = size(); // Only values matter, order does not matter int[] sorta = Utils.sort(m_Objects), sortb = Utils.sort(b.m_Objects); for (int j = 0; j < size; j++) { if (m_Objects[sorta[j]] != b.m_Objects[sortb[j]]) { return false; } } return true; }
/** * Check whether the two integer vectors equal to each other Two integer * vectors are equal if all the elements are the same, regardless of the * order of the elements * * @param b another integer vector * @return whether they are equal */ private boolean equal(DynamicIntArray b) { if ((b == null) || (size() != b.size())) { return false; } int size = size(); // Only values matter, order does not matter int[] sorta = Utils.sort(m_Objects), sortb = Utils.sort(b.m_Objects); for (int j = 0; j < size; j++) { if (m_Objects[sorta[j]] != b.m_Objects[sortb[j]]) { return false; } } return true; }
public static double L_RankLoss(int y[], double rpred[]) { // works with missing double[][] aligned = align(y, rpred); y = toIntArray(aligned[0]); rpred = aligned[1]; int r[] = Utils.sort(rpred); return L_RankLoss(y, r); }
int[] ranking = Utils.sort(merit);
public static double L_RankLoss(int y[], double rpred[]) { // works with missing double[][] aligned = align(y, rpred); y = toIntArray(aligned[0]); rpred = aligned[1]; int r[] = Utils.sort(rpred); return L_RankLoss(y, r); }
/** * returns the ranking in a string representation. * * @return the ranking */ public String toStringRanking() { String result; int[] ranking; int i; int curr; if (m_RankingWins == null) return "-ranking data not set-"; result = ">-<,>,<,Resultset\n"; ranking = Utils.sort(m_RankingDiff); for (i = getColCount() - 1; i >= 0; i--) { curr = ranking[i]; if (getColHidden(curr)) continue; result += m_RankingDiff[curr] + "," + m_RankingWins[curr] + "," + m_RankingLosses[curr] + "," + removeFilterName(m_ColNames[curr]) + "\n"; } return result; }
+ "\\\\\n\\hline\n"; ranking = Utils.sort(m_RankingDiff); for (i = getColCount() - 1; i >= 0; i--) { curr = ranking[i];
/** * returns the ranking in a string representation. * * @return the ranking */ public String toStringRanking() { String result; int[] ranking; int i; int curr; if (m_RankingWins == null) return "-ranking data not set-"; result = ">-<,>,<,Resultset\n"; ranking = Utils.sort(m_RankingDiff); for (i = getColCount() - 1; i >= 0; i--) { curr = ranking[i]; if (getColHidden(curr)) continue; result += m_RankingDiff[curr] + "," + m_RankingWins[curr] + "," + m_RankingLosses[curr] + "," + removeFilterName(m_ColNames[curr]) + "\n"; } return result; }
+ "</tr>\n"; ranking = Utils.sort(m_RankingDiff);
/** * Gets the index of the instance with the closest threshold value to the * desired target * * @param tcurve a set of instances that have been generated by this class * @param threshold the target threshold * @return the index of the instance that has threshold closest to the target, * or -1 if this could not be found (i.e. no data, or bad threshold * target) */ public static int getThresholdInstance(Instances tcurve, double threshold) { if (!RELATION_NAME.equals(tcurve.relationName()) || (tcurve.numInstances() == 0) || (threshold < 0) || (threshold > 1.0)) { return -1; } if (tcurve.numInstances() == 1) { return 0; } double[] tvals = tcurve.attributeToDoubleArray(tcurve.numAttributes() - 1); int[] sorted = Utils.sort(tvals); return binarySearch(sorted, tvals, threshold); }
/** * Gets the index of the instance with the closest threshold value to the * desired target * * @param tcurve a set of instances that have been generated by this class * @param threshold the target threshold * @return the index of the instance that has threshold closest to the target, * or -1 if this could not be found (i.e. no data, or bad threshold * target) */ public static int getThresholdInstance(Instances tcurve, double threshold) { if (!RELATION_NAME.equals(tcurve.relationName()) || (tcurve.numInstances() == 0) || (threshold < 0) || (threshold > 1.0)) { return -1; } if (tcurve.numInstances() == 1) { return 0; } double[] tvals = tcurve.attributeToDoubleArray(tcurve.numAttributes() - 1); int[] sorted = Utils.sort(tvals); return binarySearch(sorted, tvals, threshold); }
int[] sortedIndices = Utils.sort(weights);
int [] sorted = Utils.sort(attVals); int currentCount = 0; double prev = Instance.missingValue();
m_Indices[j] = Utils.sort(avgClassValues[j]);