本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntList.toIntArray方法的典型用法代码示例。如果您正苦于以下问题:Java IntList.toIntArray方法的具体用法?Java IntList.toIntArray怎么用?Java IntList.toIntArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.IntList
的用法示例。
在下文中一共展示了IntList.toIntArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: featurize
import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
public LearningInstance featurize(JsonNode entity, boolean update) {
Map<String, List<Feature>> feaMap = FeaturizerUtilities.getFeatureMap(entity, true,
featureExtractors, indexSpace);
String group = null;
if (groupKeys != null && groupKeys.size() > 0) {
group = FeatureExtractorUtilities.composeConcatenatedKey(entity, groupKeys);
}
TensorFlowInstance instance = new TensorFlowInstance(group);
for (Map.Entry<String, List<Feature>> entry : feaMap.entrySet()) {
DoubleList doubles = new DoubleArrayList();
IntList ints = new IntArrayList();
for (Feature feature : entry.getValue()) {
doubles.add(feature.getValue());
ints.add(feature.getIndex());
}
double[] darr = doubles.toDoubleArray();
instance.putValues(entry.getKey(), darr);
int[] iarr = ints.toIntArray();
instance.putIndices(entry.getKey(), iarr);
}
return instance;
}
示例2: rerankPermutation
import it.unimi.dsi.fastutil.ints.IntList; //导入方法依赖的package包/类
/**
* Returns the permutation to obtain the re-ranking
*
* @return permutation to obtain the re-ranking
*/
public int[] rerankPermutation() {
List<Tuple2od<I>> list = recommendation.getItems();
IntList perm = new IntArrayList();
IntLinkedOpenHashSet remainingI = new IntLinkedOpenHashSet();
IntStream.range(0, list.size()).forEach(remainingI::add);
while (!remainingI.isEmpty() && perm.size() < min(maxLength, cutoff)) {
int bestI = selectItem(remainingI, list);
perm.add(bestI);
remainingI.remove(bestI);
update(list.get(bestI));
}
while (perm.size() < min(maxLength, list.size())) {
perm.add(remainingI.removeFirstInt());
}
return perm.toIntArray();
}