本文整理汇总了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;
}
示例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]);
}
示例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);
}