@Override public ArrayList<ClusterType> initializeClusters(int numClusters, Collection<? extends DataType> elements) { List<? extends DataType> elementsList = elements instanceof List ? (List<? extends DataType>) elements : new ArrayList<>(elements); ArrayList<DataType> representativePoints = DiscreteSamplingUtil.sampleWithReplacement(random, elementsList, numClusters); ArrayList<ClusterType> clusters = representativePoints.stream() .map(point -> creator.createCluster(Arrays.asList(point))) .collect(Collectors.toCollection(ArrayList::new)); return clusters; }
@Override public ArrayList<ClusterType> initializeClusters(int numClusters, Collection<? extends DataType> elements) { List<? extends DataType> elementsList = elements instanceof List ? (List<? extends DataType>) elements : new ArrayList<>(elements); ArrayList<DataType> representativePoints = DiscreteSamplingUtil.sampleWithReplacement(random, elementsList, numClusters); ArrayList<ClusterType> clusters = representativePoints.stream() .map(point -> creator.createCluster(Arrays.asList(point))) .collect(Collectors.toCollection(ArrayList::new)); return clusters; }
@Override public ArrayList<ClusterType> initializeClusters(int numClusters, Collection<? extends DataType> elements) { List<? extends DataType> elementsList = elements instanceof List ? (List<? extends DataType>) elements : new ArrayList<>(elements); ArrayList<DataType> representativePoints = DiscreteSamplingUtil.sampleWithReplacement(random, elementsList, numClusters); ArrayList<ClusterType> clusters = representativePoints.stream() .map(point -> creator.createCluster(Arrays.asList(point))) .collect(Collectors.toCollection(ArrayList::new)); return clusters; }
= DiscreteSamplingUtil.sampleWithReplacement(random, dataIndices, minibatchSize);
= DiscreteSamplingUtil.sampleWithReplacement(random, dataIndices, minibatchSize);
= DiscreteSamplingUtil.sampleWithReplacement(random, dataIndices, minibatchSize);