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


Java AsynchronousMapper类代码示例

本文整理汇总了Java中edu.berkeley.nlp.mapper.AsynchronousMapper的典型用法代码示例。如果您正苦于以下问题:Java AsynchronousMapper类的具体用法?Java AsynchronousMapper怎么用?Java AsynchronousMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doIter

import edu.berkeley.nlp.mapper.AsynchronousMapper; //导入依赖的package包/类
private double doIter() {
	List<GradMapper> gradMappers = new ArrayList<GradMapper>();
	for (ObjectiveItemDifferentiableFunction<I> itemFn : itemFns) {
		gradMappers.add(new GradMapper(itemFn));
	}
	List<I> shuffledItems = shuffleData ? CollectionUtils.shuffle(items,
			rand) : new ArrayList<I>(items);
	AsynchronousMapper.doMapping(shuffledItems, gradMappers);

	// List<ValMapper> valMappers = new ArrayList<ValMapper>();
	// for (ObjectiveItemDifferentiableFunction<I> itemFn : itemFns) {
	// valMappers.add(new ValMapper(itemFn));
	// }
	// AsynchronousMapper.doMapping(items,valMappers);

	double val = 0.0;
	for (GradMapper mapper : gradMappers) {
		val += mapper.val;
	}
	return val;
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:22,代码来源:StochasticObjectiveOptimizer.java

示例2: calculate

import edu.berkeley.nlp.mapper.AsynchronousMapper; //导入依赖的package包/类
@Override
protected Pair<Double, double[]> calculate(double[] x) {
	for (ObjectiveItemDifferentiableFunction<I> itemFn : itemFns) {
		itemFn.setWeights(x);
	}
	List<Mapper> mappers = getMappers();
	AsynchronousMapper.doMapping(items, mappers);
	double objVal = 0.0;
	double[] grad = new double[dimension()];
	for (Mapper mapper : mappers) {
		objVal += mapper.objVal;
		DoubleArrays.addInPlace(grad, mapper.localGrad);
	}
	if (regularizer != null) {
		objVal += regularizer.update(x, grad, 1.0);
	}
	return Pair.newPair(objVal, grad);
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:19,代码来源:CachingObjectiveDifferentiableFunction.java

示例3: doIter

import edu.berkeley.nlp.mapper.AsynchronousMapper; //导入依赖的package包/类
private double doIter() {
	List<Mapper> mappers = new ArrayList<Mapper>();
	for (ObjectiveItemDifferentiableFunction<I> itemFn : itemFns) {
		mappers.add(new Mapper(itemFn));
	}
	AsynchronousMapper.doMapping(items, mappers);
	double val = 0.0;
	for (Mapper mapper : mappers) {
		val += mapper.val;
	}
	return val;
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:13,代码来源:OldStochasticObjectiveOptimizer.java


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