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


Java DenseVector类代码示例

本文整理汇总了Java中it.uniroma2.sag.kelp.data.representation.vector.DenseVector的典型用法代码示例。如果您正苦于以下问题:Java DenseVector类的具体用法?Java DenseVector怎么用?Java DenseVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testCopyDense

import it.uniroma2.sag.kelp.data.representation.vector.DenseVector; //导入依赖的package包/类
@Test
public void testCopyDense() {
	DenseVector aVector = (DenseVector) a.getRepresentation(denseName);
	DenseVector copyVector = aVector.copyVector();
	DenseVector copy = (DenseVector) copyVector;
	
	Assert.assertEquals(aVector.getTextFromData(), copy.getTextFromData());
	Assert.assertNotSame(copy, aVector);
	
	DenseMatrix64F featureValuesOIrig = aVector.getFeatureValues();
	DenseMatrix64F featureValuesCopy = copy.getFeatureValues();
	
	Assert.assertEquals(featureValuesOIrig.numCols, featureValuesCopy.numCols);
	Assert.assertEquals(featureValuesOIrig.numRows, featureValuesCopy.numRows);
	
	for (int i=0; i<featureValuesCopy.data.length; ++i) {
		Assert.assertEquals(featureValuesOIrig.data[i], featureValuesCopy.data[i], 0.000000001f);
	}
}
 
开发者ID:SAG-KeLP-Legacy,项目名称:kelp-full,代码行数:20,代码来源:VectorsTest.java

示例2: testDenseStandardization

import it.uniroma2.sag.kelp.data.representation.vector.DenseVector; //导入依赖的package包/类
@Test
public void testDenseStandardization() {
	StandardizationManipulator standardizer = new StandardizationManipulator(denseName, dataset.getExamples());
	dataset.manipulate(standardizer);
	DenseVector vector = new DenseVector();
	try {
		vector.setDataFromText("0.9999999701976776,-1.154700552067176,0");
		DenseVector vecA = (DenseVector) dataset.getExample(0).getRepresentation(denseName);
		vector.add(-1, vecA);
		Assert.assertTrue(vector.getSquaredNorm() < 0.0001f);
		vector.setDataFromText("-1.0000000298023224,0.5773502244144524,0");
		DenseVector vecB = (DenseVector) dataset.getExample(1).getRepresentation(denseName);
		vector.add(-1, vecB);
		Assert.assertTrue(vector.getSquaredNorm() < 0.0001f);
		vector.setDataFromText("-2.9802322387695312E-8,0.5773502244144524,0");
		DenseVector vecC = (DenseVector) dataset.getExample(2).getRepresentation(denseName);
		vector.add(-1, vecC);
		Assert.assertTrue(vector.getSquaredNorm() < 0.0001f);
	} catch (Exception e) {
		e.printStackTrace();
		Assert.fail();
	}
	Assert.assertTrue(true);
}
 
开发者ID:SAG-KeLP-Legacy,项目名称:kelp-full,代码行数:25,代码来源:VectorStandardizationTest.java

示例3: testDenseSum

import it.uniroma2.sag.kelp.data.representation.vector.DenseVector; //导入依赖的package包/类
@Test
public void testDenseSum() {
	DenseVector aVector = (DenseVector) a.getRepresentation(denseName);
	DenseVector bVector = (DenseVector) b.getRepresentation(denseName);
	
	aVector.add(bVector);
	
	Assert.assertEquals(1.0f, aVector.getFeatureValue(0), 0.0001f);
	Assert.assertEquals(1.0f, aVector.getFeatureValue(1), 0.0001f);
	Assert.assertEquals(2.0f, aVector.getFeatureValue(2), 0.0001f);	
}
 
开发者ID:SAG-KeLP-Legacy,项目名称:kelp-full,代码行数:12,代码来源:VectorsTest.java

示例4: testDenseSumWithCoefficient

import it.uniroma2.sag.kelp.data.representation.vector.DenseVector; //导入依赖的package包/类
@Test
public void testDenseSumWithCoefficient() {
	DenseVector aVector = (DenseVector) a.getRepresentation(denseName);
	DenseVector bVector = (DenseVector) b.getRepresentation(denseName);
	
	aVector.add(2.0f, bVector);
	
	Assert.assertEquals(1.0f, aVector.getFeatureValue(0), 0.0001f);
	Assert.assertEquals(2.0f, aVector.getFeatureValue(1), 0.0001f);
	Assert.assertEquals(3.0f, aVector.getFeatureValue(2), 0.0001f);	
}
 
开发者ID:SAG-KeLP-Legacy,项目名称:kelp-full,代码行数:12,代码来源:VectorsTest.java

示例5: testDensePointWiseProduct

import it.uniroma2.sag.kelp.data.representation.vector.DenseVector; //导入依赖的package包/类
@Test
public void testDensePointWiseProduct() {
	DenseVector aVector = (DenseVector) a.getRepresentation(denseName);
	DenseVector bVector = (DenseVector) b.getRepresentation(denseName);
	
	aVector.pointWiseProduct(bVector);
	
	Assert.assertEquals(0.0f, aVector.getFeatureValue(0), 0.0001f);
	Assert.assertEquals(0.0f, aVector.getFeatureValue(1), 0.0001f);
	Assert.assertEquals(1.0f, aVector.getFeatureValue(2), 0.0001f);
}
 
开发者ID:SAG-KeLP-Legacy,项目名称:kelp-full,代码行数:12,代码来源:VectorsTest.java

示例6: testDenseInnerProduct

import it.uniroma2.sag.kelp.data.representation.vector.DenseVector; //导入依赖的package包/类
@Test
public void testDenseInnerProduct() {
	DenseVector aVector = (DenseVector) a.getRepresentation(denseName);
	DenseVector bVector = (DenseVector) b.getRepresentation(denseName);
	
	float innerProduct = aVector.innerProduct(bVector);
	
	Assert.assertEquals(1.0f, innerProduct, 0.000001f);
}
 
开发者ID:SAG-KeLP-Legacy,项目名称:kelp-full,代码行数:10,代码来源:VectorsTest.java


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