/** * Shuffles the elements of this list among several smaller lists. * @param proportions A list of numbers (not necessarily summing to 1) which, * when normalized, correspond to the proportion of elements in each returned * sublist. This method (and all the split methods) do not transfer the Instance * weights to the resulting InstanceLists. * @param r The source of randomness to use in shuffling. * @return one <code>InstanceList</code> for each element of <code>proportions</code> */ public InstanceList[] split (java.util.Random r, double[] proportions) { InstanceList shuffled = this.shallowClone(); shuffled.shuffle (r); return shuffled.splitInOrder(proportions); }
public InstanceList subList (double proportion) { if (proportion > 1.0) throw new IllegalArgumentException ("proportion must by <= 1.0"); InstanceList other = (InstanceList) clone(); other.shuffle(new java.util.Random()); proportion *= other.size(); for (int i = 0; i < proportion; i++) other.add (get(i)); return other; }
public InstanceList subList (double proportion) { if (proportion > 1.0) throw new IllegalArgumentException ("proportion must by <= 1.0"); InstanceList other = (InstanceList) clone(); other.shuffle(new java.util.Random()); proportion *= other.size(); for (int i = 0; i < proportion; i++) other.add (get(i)); return other; }
/** * Shuffles the elements of this list among several smaller lists. * @param proportions A list of numbers (not necessarily summing to 1) which, * when normalized, correspond to the proportion of elements in each returned * sublist. This method (and all the split methods) do not transfer the Instance * weights to the resulting InstanceLists. * @param r The source of randomness to use in shuffling. * @return one <code>InstanceList</code> for each element of <code>proportions</code> */ public InstanceList[] split (java.util.Random r, double[] proportions) { InstanceList shuffled = this.shallowClone(); shuffled.shuffle (r); return shuffled.splitInOrder(proportions); }
/** * Shuffles the elements of this list among several smaller lists. * @param proportions A list of numbers (not necessarily summing to 1) which, * when normalized, correspond to the proportion of elements in each returned * sublist. This method (and all the split methods) do not transfer the Instance * weights to the resulting InstanceLists. * @param r The source of randomness to use in shuffling. * @return one <code>InstanceList</code> for each element of <code>proportions</code> */ public InstanceList[] split (java.util.Random r, double[] proportions) { InstanceList shuffled = this.shallowClone(); shuffled.shuffle (r); return shuffled.splitInOrder(proportions); }
public InstanceList subList (double proportion) { if (proportion > 1.0) throw new IllegalArgumentException ("proportion must by <= 1.0"); InstanceList other = (InstanceList) clone(); other.shuffle(new java.util.Random()); proportion *= other.size(); for (int i = 0; i < proportion; i++) other.add (get(i)); return other; }
trainingInstances.shuffle(random); Clustering trainingClustering = createSmallerClustering(trainingInstances); testingInstances.shuffle(random); Clustering testingClustering = createSmallerClustering(testingInstances); logger.info(outputPrefixFile.value + ".train : " + trainingClustering.getNumClusters() + " objects");
trainingInstances.shuffle(random); Clustering trainingClustering = createSmallerClustering(trainingInstances); testingInstances.shuffle(random); Clustering testingClustering = createSmallerClustering(testingInstances); logger.info(outputPrefixFile.value + ".train : " + trainingClustering.getNumClusters() + " objects");
trainingInstances.shuffle(random); Clustering trainingClustering = createSmallerClustering(trainingInstances); testingInstances.shuffle(random); Clustering testingClustering = createSmallerClustering(testingInstances); logger.info(outputPrefixFile.value + ".train : " + trainingClustering.getNumClusters() + " objects");