use of org.apache.ignite.ml.tree.randomforest.data.statistics.NormalDistributionStatisticsComputer in project ignite by apache.
the class RandomForestTrainer method computeHistogramMeta.
/**
* Compute bucket metas based on feature metas and learning dataset.
*
* @param meta Features meta.
* @param dataset Dataset.
* @return bucket metas.
*/
private Map<Integer, BucketMeta> computeHistogramMeta(List<FeatureMeta> meta, Dataset<EmptyContext, BootstrappedDatasetPartition> dataset) {
List<NormalDistributionStatistics> stats = new NormalDistributionStatisticsComputer().computeStatistics(meta, dataset);
if (stats == null)
return Collections.emptyMap();
Map<Integer, BucketMeta> bucketsMeta = new HashMap<>();
for (int i = 0; i < stats.size(); i++) {
BucketMeta bucketMeta = new BucketMeta(meta.get(i));
if (!bucketMeta.getFeatureMeta().isCategoricalFeature()) {
NormalDistributionStatistics stat = stats.get(i);
bucketMeta.setMinVal(stat.min());
bucketMeta.setBucketSize(stat.std() * BUCKET_SIZE_FACTOR);
}
bucketsMeta.put(i, bucketMeta);
}
return bucketsMeta;
}
Aggregations