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


Java MapTransformer.getInstance方法代码示例

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


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

示例1: lengthTransformation

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
/** This method does the following length transformation:
 * 
 * <pre> c'(v,w) = c(v,w) - d (s,w) + d (s,v) </pre>
 * 
 * @param graph1 the graph
 * @param slTrans The shortest length transformer
 * @return the transformed graph
 * @since 0.3.0 */
private Transformer<E, Double> lengthTransformation(Graph<V, E> graph1, Transformer<V, Number> slTrans)
{
	Map<E, Double> map = new LinkedHashMap<E, Double>();

	for (E link : graph1.getEdges())
	{
		double newWeight;

		if (slTrans.transform(graph1.getSource(link)) == null)
		{
			newWeight = Double.MAX_VALUE;
		} else
		{
			newWeight = nev.transform(link) - slTrans.transform(graph1.getDest(link)).doubleValue() + slTrans.transform(graph1.getSource(link)).doubleValue();
			if (newWeight < 0 || newWeight > -1e-6) newWeight = 0; /* Numerical errors */
		}

		map.put(link, newWeight);
	}

	return MapTransformer.getInstance(map);
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:31,代码来源:GraphUtils.java

示例2: lengthTransformation

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
/**
 * This method does the following length transformation:
 * 
 * <pre>
 *  c'(v,w) = c(v,w) - d (s,w) + d (s,v)
 * </pre>
 * 
 * @param graph1
 *            the graph
 * @param slTrans
 *            The shortest length transformer
 * @return the transformed graph
 */
private Transformer<E, Double> lengthTransformation(Graph<V, E> graph1,
		Transformer<V, Number> slTrans) {
	Map<E, Double> map = new HashMap<E, Double>();

	for (E link : graph1.getEdges()) {
		double newWeight = nev.transform(link).doubleValue()
				- slTrans.transform(graph1.getDest(link)).doubleValue()
				+ slTrans.transform(graph1.getSource(link)).doubleValue();

		map.put(link, newWeight);
	}
	return MapTransformer.getInstance(map);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:27,代码来源:SuurballeTarjan.java

示例3: performPageRank

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
@Override
protected PageRankWithPriors<Vertex, Edge> performPageRank() {
	PageRankWithPriors<Vertex, Edge> pr = new PageRankWithPriors<Vertex, Edge>(
			graph, MapTransformer.getInstance(edgeWeights),
			getRootPrior(graph.getVertices()), 0.13);
	pr.setMaxIterations(250);
	pr.evaluate();
	return pr;
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:10,代码来源:FinalEntityDisambiguatorGeneral.java

示例4: performPageRank

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
@Override
protected PageRankWithPriors<Vertex, Edge> performPageRank() {
	PageRankWithPriors<Vertex, Edge> pr = new PageRankWithPriors<Vertex, Edge>(
			graph, MapTransformer.getInstance(edgeWeights),
			getRootPrior(graph.getVertices()), 0.09);
	pr.setMaxIterations(iterations);
	pr.evaluate();
	return pr;
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:10,代码来源:Word2VecDisambiguatorGeneral.java

示例5: performPageRank

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
@Override
protected PageRankWithPriors<Vertex, Edge> performPageRank() {
	PageRankWithPriors<Vertex, Edge> pr = new PageRankWithPriors<Vertex, Edge>(
			graph, MapTransformer.getInstance(edgeWeights),
			getRootPrior(graph.getVertices()), 0.13);
	pr.setMaxIterations(75);
	pr.evaluate();
	return pr;
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:10,代码来源:FinalEntityDisambiguation.java

示例6: performPageRank

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
protected PageRankWithPriors<Vertex, Edge> performPageRank() {
	PageRankWithPriors<Vertex, Edge> pr = new PageRankWithPriors<Vertex, Edge>(
			graph, MapTransformer.getInstance(edgeWeights),
			getRootPrior(graph.getVertices()), 0.15);
	pr.setMaxIterations(200);
	pr.evaluate();
	return pr;
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:9,代码来源:AbstractWord2VecPageRank.java

示例7: performPageRank

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
protected PageRankWithPriors<Vertex, Edge> performPageRank() {
	PageRankWithPriors<Vertex, Edge> pr = new PageRankWithPriors<Vertex, Edge>(graph,
			MapTransformer.getInstance(edgeWeights), getRootPrior(graph.getVertices()), 0.15);
	pr.setMaxIterations(200);
	pr.evaluate();
	return pr;
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:8,代码来源:AbstractWord2VecPageRank.java

示例8: process

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
@Override
public String process(Map<DisambiguatedEntity, Integer> map, Paragraph p, Languages lang) {
	Set<String> entitySet = new HashSet<String>();
	List<String> entities = new LinkedList<String>();
	for (Map.Entry<DisambiguatedEntity, Integer> entry : map.entrySet()) {
		entities.add(entry.getKey().getEntityUri());
		entitySet.add(entry.getKey().getEntityUri());
	}
	if (entities.size() == 0) {
		return "";
	} else {
		computeWord2VecSimilarities(entitySet);
		DirectedGraph<Vertex, Edge> graph = buildGraph(entities);

		PageRank<Vertex, Edge> pr = new PageRank<Vertex, Edge>(graph,
				MapTransformer.getInstance(edgeWeights), 0.1);
		pr.setMaxIterations(100);
		pr.evaluate();
		Collection<Vertex> vertexCol = graph.getVertices();
		String topEntity = null;
		double max = 0;
		for (Vertex v : vertexCol) {
			Double score = pr.getVertexScore(v);
			if (score > max) {
				topEntity = v.getUris().get(0);
				max = score;
			}
		}
		return topEntity;
	}
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:32,代码来源:EntitySignificanceAlgorithmPR_W2V.java

示例9: lengthTransformation

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
/**
 * This method does the following length transformation:
 * <p/>
 * <pre>
 *  c'(v,w) = c(v,w) - d (s,w) + d (s,v)
 * </pre>
 *
 * @param graph1  the graph
 * @param slTrans The shortest length transformer
 * @return the transformed graph
 */
private Transformer<E, Double> lengthTransformation(Graph<V, E> graph1,
                                                    Transformer<V, Number> slTrans) {
    Map<E, Double> map = new HashMap<E, Double>();

    for (E link : graph1.getEdges()) {
        double newWeight = nev.transform(link).doubleValue()
                - slTrans.transform(graph1.getDest(link)).doubleValue()
                + slTrans.transform(graph1.getSource(link)).doubleValue();

        map.put(link, newWeight);
    }
    return MapTransformer.getInstance(map);
}
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:25,代码来源:SuurballeTarjan.java

示例10: getStationaryDistribution

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
/**
 * Loads the stationary distribution into a vector if it was passed in,
 * or calculates it if not.
 *
 * @return DoubleMatrix1D
 */
private DoubleMatrix1D getStationaryDistribution() {
    DoubleMatrix1D piVector = new DenseDoubleMatrix1D(getVertexCount());
    PageRank<V,E> pageRank = new PageRank<V,E>(getGraph(), 
            MapTransformer.getInstance(getEdgeWeights()), 0);
    pageRank.evaluate();
    
    for (V v : getGraph().getVertices())
        piVector.set(mIndexer.get(v), pageRank.getVertexScore(v));
    return piVector;
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:17,代码来源:MarkovCentrality.java

示例11: getSetToCollapsedVertexTransformer

import org.apache.commons.collections15.functors.MapTransformer; //导入方法依赖的package包/类
/**
 * Returns a transformer from vertex sets in the original graph to collapsed vertices
 * in the transformed graph.
 */
public Transformer<Set<V>, CV> getSetToCollapsedVertexTransformer()
{
    return MapTransformer.getInstance(set_collapsedv);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:9,代码来源:VertexPartitionCollapser.java


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