本文整理汇总了Java中org.deeplearning4j.berkeley.Pair.getSecond方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getSecond方法的具体用法?Java Pair.getSecond怎么用?Java Pair.getSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.deeplearning4j.berkeley.Pair
的用法示例。
在下文中一共展示了Pair.getSecond方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: probability
import org.deeplearning4j.berkeley.Pair; //导入方法依赖的package包/类
@Override
public @NotNull Double probability(@NotNull Type type) {
for (Pair<String, Double> score : scores) {
if (score.getFirst().equals(type.name())) {
return score.getSecond() / 2 + 0.5;
}
}
return 0.0;
}
示例2: checkUnlabelledData
import org.deeplearning4j.berkeley.Pair; //导入方法依赖的package包/类
private void checkUnlabelledData(Word2Vec paragraphVectors, LabelAwareIterator iterator, TokenizerFactory tokenizerFactory) throws FileNotFoundException {
ClassPathResource unClassifiedResource = new ClassPathResource("papers/unlabeled");
FileLabelAwareIterator unClassifiedIterator = new FileLabelAwareIterator.Builder()
.addSourceFolder(unClassifiedResource.getFile())
.build();
MeansBuilder meansBuilder = new MeansBuilder(
(InMemoryLookupTable<VocabWord>) paragraphVectors.getLookupTable(),
tokenizerFactory);
LabelSeeker seeker = new LabelSeeker(iterator.getLabelsSource().getLabels(),
(InMemoryLookupTable<VocabWord>) paragraphVectors.getLookupTable());
System.out.println(paragraphVectors + " classification results");
double cc = 0;
double size = 0;
while (unClassifiedIterator.hasNextDocument()) {
LabelledDocument document = unClassifiedIterator.nextDocument();
INDArray documentAsCentroid = meansBuilder.documentAsVector(document);
List<Pair<String, Double>> scores = seeker.getScores(documentAsCentroid);
double max = -Integer.MAX_VALUE;
String cat = null;
for (Pair<String, Double> p : scores) {
if (p.getSecond() > max) {
max = p.getSecond();
cat = p.getFirst();
}
}
if (document.getLabels().contains(cat)) {
cc++;
}
size++;
}
System.out.println("acc:" + (cc / size));
}