MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / getSampledDataSet

Method getSampledDataSet

JSAT/src/jsat/classifiers/boosting/Bagging.java:288–300  ·  view source on GitHub ↗

Creates a new data set from the given sample counts. Points sampled multiple times will have multiple entries in the data set. @param dataSet the data set that was sampled from @param sampledCounts the sampling values obtained from #sampleWithReplacement(int[], int, java.util.Random) @retur

(ClassificationDataSet dataSet, int[] sampledCounts)

Source from the content-addressed store, hash-verified

286 * @return a new sampled classification data set
287 */
288 public static ClassificationDataSet getSampledDataSet(ClassificationDataSet dataSet, int[] sampledCounts)
289 {
290 ClassificationDataSet destination = new ClassificationDataSet(dataSet.getNumNumericalVars(), dataSet.getCategories(), dataSet.getPredicting());
291
292 for (int i = 0; i < sampledCounts.length; i++)
293 for(int j = 0; j < sampledCounts[i]; j++)
294 {
295 DataPoint dp = dataSet.getDataPoint(i);
296 destination.addDataPoint(dp.getNumericalValues(), dp.getCategoricalValues(), dataSet.getDataPointCategory(i));
297 }
298
299 return destination;
300 }
301
302 /**
303 * Creates a new data set from the given sample counts. Points sampled

Callers 2

trainCMethod · 0.95
trainMethod · 0.95

Calls 10

addDataPointMethod · 0.95
getNumericalValuesMethod · 0.95
getCategoricalValuesMethod · 0.95
addDataPointMethod · 0.95
getNumNumericalVarsMethod · 0.80
getCategoriesMethod · 0.80
getPredictingMethod · 0.80
getDataPointCategoryMethod · 0.80
getTargetValueMethod · 0.80
getDataPointMethod · 0.45

Tested by

no test coverage detected