当前位置: 首页>>代码示例>>Java>>正文


Java ObjectDoubleOpenHashMap.put方法代码示例

本文整理汇总了Java中com.carrotsearch.hppc.ObjectDoubleOpenHashMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectDoubleOpenHashMap.put方法的具体用法?Java ObjectDoubleOpenHashMap.put怎么用?Java ObjectDoubleOpenHashMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.carrotsearch.hppc.ObjectDoubleOpenHashMap的用法示例。


在下文中一共展示了ObjectDoubleOpenHashMap.put方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import com.carrotsearch.hppc.ObjectDoubleOpenHashMap; //导入方法依赖的package包/类
@Test
public void test() {
    Model model = ModelFactory.createDefaultModel();
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(GRAPH_FILE);
    model.read(is, null, "N3");
    IOUtils.closeQuietly(is);

    GraphCreator creator = new GraphCreator();
    ColouredGraph graph = creator.processModel(model);

    EdgeColourDistributionMetric metric = new EdgeColourDistributionMetric();
    ObjectDistribution<BitSet> distribution = metric.apply(graph);

    ObjectDoubleOpenHashMap<BitSet> expectedCounts = new ObjectDoubleOpenHashMap<BitSet>();
    ColourPalette palette = graph.getEdgePalette();
    for (int i = 0; i < EXPECTED_PROPERTY_URIS.length; ++i) {
        expectedCounts.put(palette.getColour(EXPECTED_PROPERTY_URIS[i]), EXPECTED_PROPERTY_COUNTS[i]);
    }

    for (int i = 0; i < distribution.sampleSpace.length; ++i) {
        Assert.assertTrue(expectedCounts.containsKey(distribution.sampleSpace[i]));
        Assert.assertEquals(expectedCounts.get(distribution.sampleSpace[i]), distribution.values[i]);
    }
    Assert.assertEquals(expectedCounts.size(), distribution.sampleSpace.length);
}
 
开发者ID:dice-group,项目名称:Lemming,代码行数:26,代码来源:EdgeColourDistributionMetricTest.java

示例2: test

import com.carrotsearch.hppc.ObjectDoubleOpenHashMap; //导入方法依赖的package包/类
@Test
public void test() {
    Model model = ModelFactory.createDefaultModel();
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(GRAPH_FILE);
    model.read(is, null, "N3");
    IOUtils.closeQuietly(is);

    GraphCreator creator = new GraphCreator();
    ColouredGraph graph = creator.processModel(model);

    VertexColourDistributionMetric metric = new VertexColourDistributionMetric();
    ObjectDistribution<BitSet> distribution = metric.apply(graph);

    ObjectDoubleOpenHashMap<BitSet> expectedCounts = new ObjectDoubleOpenHashMap<BitSet>();
    ColourPalette palette = graph.getVertexPalette();
    BitSet colour;
    for (int i = 0; i < EXPECTED_VERTEX_CLASSES.length; ++i) {
        if (EXPECTED_VERTEX_CLASSES[i].contains("|")) {
            colour = palette.getColourMixture(EXPECTED_VERTEX_CLASSES[i].split("\\|"));
        } else {
            colour = palette.getColour(EXPECTED_VERTEX_CLASSES[i]);
        }
        Assert.assertTrue("There is no colour for " + EXPECTED_VERTEX_CLASSES[i], colour.cardinality() > 0);
        expectedCounts.put(colour, EXPECTED_VERTEX_COUNTS[i]);
    }
    expectedCounts.put(new BitSet(), EXPECTED_VERTEXES_WITHOUT_COLOURS);

    for (int i = 0; i < distribution.sampleSpace.length; ++i) {
        Assert.assertTrue(expectedCounts.containsKey(distribution.sampleSpace[i]));
        Assert.assertEquals(expectedCounts.get(distribution.sampleSpace[i]), distribution.values[i]);
    }
    Assert.assertEquals(expectedCounts.size(), distribution.sampleSpace.length);
}
 
开发者ID:dice-group,项目名称:Lemming,代码行数:34,代码来源:VertexColourDistributionMetricTest.java

示例3: calculateNCRP

import com.carrotsearch.hppc.ObjectDoubleOpenHashMap; //导入方法依赖的package包/类
public void calculateNCRP(ObjectDoubleOpenHashMap<NCRPNode> nodeWeights, 
					  NCRPNode node, double weight) {
for (NCRPNode child: node.children) {
	calculateNCRP(nodeWeights, child,
				  weight + Math.log((double) child.customers / (node.customers + gamma)));
}

nodeWeights.put(node, weight + Math.log(gamma / (node.customers + gamma)));
  }
 
开发者ID:cmoen,项目名称:mallet,代码行数:10,代码来源:HierarchicalLDA.java

示例4: calculateGraphMetrics

import com.carrotsearch.hppc.ObjectDoubleOpenHashMap; //导入方法依赖的package包/类
/**
 * The values of the metrics are calculated for the given graph and put into
 * a map.
 * 
 * @param graph
 *            {@link ColouredGraph} for which the values should be
 *            calculated.
 * @return a mapping from metric name to metric value for the given graph
 */
public static ObjectDoubleOpenHashMap<String> calculateGraphMetrics(ColouredGraph graph,
        List<SingleValueMetric> metrics) {
    ObjectDoubleOpenHashMap<String> vector = new ObjectDoubleOpenHashMap<String>(2 * metrics.size());
    for (SingleValueMetric metric : metrics) {
        vector.put(metric.getName(), metric.apply(graph));
    }
    return vector;
}
 
开发者ID:dice-group,项目名称:Lemming,代码行数:18,代码来源:MetricUtils.java


注:本文中的com.carrotsearch.hppc.ObjectDoubleOpenHashMap.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。