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


Java ArrayUtils.append方法代码示例

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


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

示例1: getWeightsIndex

import cc.mallet.util.ArrayUtils; //导入方法依赖的package包/类
public int getWeightsIndex (String weightName)
{
	int wi = parameters.weightAlphabet.lookupIndex (weightName);
	if (wi == -1)
		throw new IllegalArgumentException ("Alphabet frozen, and no weight with name "+ weightName);
	if (parameters.weights == null) {
		assert (wi == 0);
		parameters.weights = new SparseVector[1];
		parameters.defaultWeights = new double[1];
		featureSelections = new FeatureSelection[1];
		parameters.weightsFrozen = new boolean [1];
		// Use initial capacity of 8
		parameters.weights[0] = new IndexedSparseVector ();
		parameters.defaultWeights[0] = 0;
		featureSelections[0] = null;
		weightsStructureChanged();
	} else if (wi == parameters.weights.length) {
		SparseVector[] newWeights = new SparseVector[parameters.weights.length+1];
		double[] newDefaultWeights = new double[parameters.weights.length+1];
		FeatureSelection[] newFeatureSelections = new FeatureSelection[parameters.weights.length+1];
		for (int i = 0; i < parameters.weights.length; i++) {
			newWeights[i] = parameters.weights[i];
			newDefaultWeights[i] = parameters.defaultWeights[i];
			newFeatureSelections[i] = featureSelections[i];
		}
		newWeights[wi] = new IndexedSparseVector ();
		newDefaultWeights[wi] = 0;
		newFeatureSelections[wi] = null;
		parameters.weights = newWeights;
		parameters.defaultWeights = newDefaultWeights;
		featureSelections = newFeatureSelections;
		parameters.weightsFrozen = ArrayUtils.append (parameters.weightsFrozen, false);
		weightsStructureChanged();
	}
	//setTrainable (false);
	return wi;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:38,代码来源:CRF.java

示例2: AgglomerativeNeighbor

import cc.mallet.util.ArrayUtils; //导入方法依赖的package包/类
/**
 *
 * @param original
 * @param modified
 * @param cluster1 Instance indices for one cluster that was merged.
 * @param cluster2 Instance indices for other cluster that was merged.
 * @return
 */
public AgglomerativeNeighbor (Clustering original,
															Clustering modified,
															int[][] oldClusters) {
	super(original, modified);
	if (oldClusters.length != 2)
		throw new IllegalArgumentException("Agglomerations of more than 2 clusters not yet implemented.");
	this.oldClusters = oldClusters;
	this.newCluster = ArrayUtils.append(oldClusters[0], oldClusters[1]);	
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:18,代码来源:AgglomerativeNeighbor.java

示例3: addWeight

import cc.mallet.util.ArrayUtils; //导入方法依赖的package包/类
public void addWeight (int didx, String weightName) {
	int widx = crf.getWeightsIndex (weightName);
	weightsIndices[didx] = ArrayUtils.append (weightsIndices[didx], widx);
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:5,代码来源:CRF.java


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