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


Java PropertyList.numericIterator方法代码示例

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


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

示例1: AugmentableFeatureVector

import cc.mallet.util.PropertyList; //导入方法依赖的package包/类
public AugmentableFeatureVector (Alphabet dict, PropertyList pl, boolean binary,
		boolean growAlphabet) {
	this (dict, binary);
	if (pl == null)
		return;
	PropertyList.Iterator iter = pl.numericIterator();
	while (iter.hasNext()) {
		iter.nextProperty();
		//System.out.println ("AugmentableVector ("+dict.size()+") adding "+iter.getKey()+" "+iter.getNumericValue());
		int index = dict.lookupIndex (iter.getKey(), growAlphabet);
		if (index >= 0)
			add (index, iter.getNumericValue());
	}
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:15,代码来源:AugmentableFeatureVector.java

示例2: BigAugmentableFeatureVector

import cc.mallet.util.PropertyList; //导入方法依赖的package包/类
public BigAugmentableFeatureVector (BigAlphabet dict, PropertyList pl, boolean binary,
		boolean growAlphabet) {
	this (dict, binary);
	if (pl == null)
		return;
	PropertyList.Iterator iter = pl.numericIterator();
	while (iter.hasNext()) {
		iter.nextProperty();
		//System.out.println ("AugmentableVector ("+dict.size()+") adding "+iter.getKey()+" "+iter.getNumericValue());
		int index = dict.lookupIndex (iter.getKey(), growAlphabet);
		if (index >= 0)
			add (index, iter.getNumericValue());
	}
}
 
开发者ID:sameeraxiomine,项目名称:largelda,代码行数:15,代码来源:BigAugmentableFeatureVector.java

示例3: SparseVector

import cc.mallet.util.PropertyList; //导入方法依赖的package包/类
public SparseVector (Alphabet dict, PropertyList pl, boolean binary,
										 boolean growAlphabet)
{
	if (pl == null) {
		// xxx Fix SparseVector so that it can properly represent a vector that has all zeros.
		// Does this work?
		indices = new int[0];
		values = null;
		return;
	}

	PropertyList.Iterator iter;
	if (binary == false) {
		binary = true;
		// If all the property list features are binary, make a binary SparseVector even if the constructor argument "binary" is false.
		// This will significantly save space, as well as multiplication time later!  -akm 12/2007
		iter = pl.numericIterator();
		while (iter.hasNext()) {
			iter.nextProperty();
			if (iter.getNumericValue() != 1.0) {
				binary = false;
				break;
			}
		}
	}
	
	AugmentableFeatureVector afv = new AugmentableFeatureVector (dict, binary);
	//afv.print();
	//System.out.println ("SparseVector binary="+binary);
	//pl.print();
	iter = pl.numericIterator();
	while (iter.hasNext()) {
		iter.nextProperty();
		//System.out.println ("SparseVector adding "+iter.getKey()+" "+iter.getNumericValue());
		int index = dict.lookupIndex(iter.getKey(), growAlphabet);
		if (index >=0) {
			afv.add (index, iter.getNumericValue());
		}
		//System.out.println ("SparseVector afv adding "+iter.getKey()+" afv.numLocations="+afv.numLocations());
	}
	//afv.print();
	// xxx Not so efficient?
	SparseVector sv = afv.toSparseVector();
	//System.out.println ("SparseVector sv.numLocations="+sv.numLocations());
	this.indices = sv.indices;
	this.values = sv.values;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:48,代码来源:SparseVector.java

示例4: BigSparseVector

import cc.mallet.util.PropertyList; //导入方法依赖的package包/类
public BigSparseVector (BigAlphabet dict, PropertyList pl, boolean binary,
										 boolean growAlphabet)
{
	if (pl == null) {
		// xxx Fix SparseVector so that it can properly represent a vector that has all zeros.
		// Does this work?
		indices = new int[0];
		values = null;
		return;
	}

	PropertyList.Iterator iter;
	if (binary == false) {
		binary = true;
		// If all the property list features are binary, make a binary SparseVector even if the constructor argument "binary" is false.
		// This will significantly save space, as well as multiplication time later!  -akm 12/2007
		iter = pl.numericIterator();
		while (iter.hasNext()) {
			iter.nextProperty();
			if (iter.getNumericValue() != 1.0) {
				binary = false;
				break;
			}
		}
	}
	
	BigAugmentableFeatureVector afv = new BigAugmentableFeatureVector (dict, binary);
	//afv.print();
	//System.out.println ("SparseVector binary="+binary);
	//pl.print();
	iter = pl.numericIterator();
	while (iter.hasNext()) {
		iter.nextProperty();
		//System.out.println ("SparseVector adding "+iter.getKey()+" "+iter.getNumericValue());
		int index = dict.lookupIndex(iter.getKey(), growAlphabet);
		if (index >=0) {
			afv.add (index, iter.getNumericValue());
		}
		//System.out.println ("SparseVector afv adding "+iter.getKey()+" afv.numLocations="+afv.numLocations());
	}
	//afv.print();
	// xxx Not so efficient?
	BigSparseVector sv = afv.toSparseVector();
	//System.out.println ("SparseVector sv.numLocations="+sv.numLocations());
	this.indices = sv.indices;
	this.values = sv.values;
}
 
开发者ID:sameeraxiomine,项目名称:largelda,代码行数:48,代码来源:BigSparseVector.java


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