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


Java Matrix.setLabel方法代码示例

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


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

示例1: main

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	Matrix m = Matrix.Factory.zeros(ValueType.OBJECT, 5, 5);
	m.randn(Ret.ORIG);
	m.setLabel("test");
	m.setColumnLabel(0, "col0");
	m.setColumnLabel(1, "col1");
	m.setColumnLabel(2, "col2");
	m.setColumnLabel(3, "col3");
	m.setColumnLabel(4, "col4");
	m.setRowLabel(0, "row0");
	m.setRowLabel(1, "row1");
	m.setRowLabel(2, "row2");
	m.setRowLabel(3, "row3");
	m.setRowLabel(4, "row4");
	m.setAsDouble(Double.NaN, 2, 2);
	m.setAsDouble(Double.NEGATIVE_INFINITY, 3, 2);
	System.out.println(m);
	System.out.println(m.includeAnnotation(Ret.NEW, Matrix.COLUMN));
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:20,代码来源:IncludeAnnotation.java

示例2: setAnnotation

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
public final static void setAnnotation(Matrix m) {
	m.setLabel("label");
	m.setDimensionLabel(Matrix.ROW, "rows");
	m.setDimensionLabel(Matrix.COLUMN, "columns");

	for (int r = 0; r < m.getRowCount(); r++) {
		if (r == 0) {
			continue;
		}
		m.setRowLabel(r, "row" + r);
	}

	for (int c = 0; c < m.getColumnCount(); c++) {
		if (c == 1) {
			continue;
		}
		m.setColumnLabel(c, "col" + c);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:20,代码来源:AbstractMatrixTest.java

示例3: calculate

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
public ListDataSet calculate(ListDataSet dataSet) throws Exception {
	product1ToIds.setLabel("Product 1 Ids");
	product2ToIds.setLabel("Product 2 Ids");

	Matrix product1Count = new CountMatrix(product1ToIds);
	product1Count.setLabel("Product 1 Count");

	Matrix product2Count = new CountMatrix(product2ToIds);
	product2Count.setLabel("Product 2 Count");

	for (int r = 0; r < dataSet.size(); r++) {

		if (r % 1000 == 0) {
			System.out.println(r + " of " + dataSet.size());
		}
		RelationalSample s = (RelationalSample) dataSet.get(r);
		Collection<?> products = s.getObjects();
		if (products.size() != 0) {
			addProduct1Count(products, r);
			addProduct2Count(products, r);
		}
	}

	return calculateP(minSupport);
}
 
开发者ID:jdmp,项目名称:java-data-mining-package,代码行数:26,代码来源:MarketBasketAnalysis.java

示例4: fromFile

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
public static final Matrix fromFile(File file, Object... parameters) throws IOException {
	FileReader lr = new FileReader(file);
	Matrix m = fromReader(lr, parameters);
	m.setLabel(file.getAbsolutePath());
	lr.close();
	return m;
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:8,代码来源:ImportMatrixSPARSECSV.java

示例5: testRows

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public void testRows() {
	Matrix m1 = Matrix.Factory.zeros(1, 2);
	m1.setLabel("label");
	m1.setRowLabel(0, "row1");
	Matrix m2 = m1.appendVertically(Ret.NEW, Matrix.Factory.zeros(1, 2));
	m2.setRowLabel(1, "row2");
	assertEquals("label", m2.getLabelObject());
	assertEquals("row1", m2.getRowLabel(0));
	assertEquals("row2", m2.getRowLabel(1));
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:12,代码来源:TestAnnotation.java

示例6: testCols

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public void testCols() {
	Matrix m1 = Matrix.Factory.zeros(2, 1);
	m1.setLabel("label");
	m1.setColumnLabel(0, "col1");
	Matrix m2 = m1.appendHorizontally(Ret.NEW, Matrix.Factory.zeros(2, 1));
	m2.setColumnLabel(1, "col2");
	assertEquals("label", m2.getLabelObject());
	assertEquals("col1", m2.getColumnLabel(0));
	assertEquals("col2", m2.getColumnLabel(1));
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:12,代码来源:TestAnnotation.java

示例7: testTransposeNewSmall

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public final void testTransposeNewSmall() throws Exception {
	Matrix m = createMatrixWithAnnotation(2, 3);
	m.setAsDouble(1.0, 0, 0);
	m.setAsDouble(2.0, 0, 1);
	m.setAsDouble(3.0, 0, 2);
	m.setAsDouble(4.0, 1, 0);
	m.setAsDouble(5.0, 1, 1);
	m.setAsDouble(6.0, 1, 2);
	m.setLabel("label");
	m.setRowLabel(1, "row1");
	m.setColumnLabel(2, "col2");
	Matrix r = m.transpose(Ret.NEW);
	assertEquals(getLabel(), m.getRowCount(), r.getColumnCount());
	assertEquals(getLabel(), m.getColumnCount(), r.getRowCount());
	assertEquals(getLabel(), 1.0, r.getAsDouble(0, 0), TOLERANCE);
	assertEquals(getLabel(), 4.0, r.getAsDouble(0, 1), TOLERANCE);
	assertEquals(getLabel(), 2.0, r.getAsDouble(1, 0), TOLERANCE);
	assertEquals(getLabel(), 5.0, r.getAsDouble(1, 1), TOLERANCE);
	assertEquals(getLabel(), 3.0, r.getAsDouble(2, 0), TOLERANCE);
	assertEquals(getLabel(), 6.0, r.getAsDouble(2, 1), TOLERANCE);
	assertEquals(getLabel(), "label", r.getLabel());
	assertEquals(getLabel(), "row1", r.getColumnLabel(1));
	assertEquals(getLabel(), "col2", r.getRowLabel(2));

	if (m instanceof Erasable) {
		((Erasable) m).erase();
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:30,代码来源:AbstractMatrixTest.java

示例8: testTransposeLinkSmall

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public final void testTransposeLinkSmall() throws Exception {
	Matrix m = createMatrixWithAnnotation(2, 3);
	m.setAsDouble(1.0, 0, 0);
	m.setAsDouble(2.0, 0, 1);
	m.setAsDouble(3.0, 0, 2);
	m.setAsDouble(4.0, 1, 0);
	m.setAsDouble(5.0, 1, 1);
	m.setAsDouble(6.0, 1, 2);
	m.setLabel("label");
	m.setRowLabel(1, "row1");
	m.setColumnLabel(2, "col2");
	Matrix r = m.transpose(Ret.LINK);
	assertEquals(getLabel(), m.getRowCount(), r.getColumnCount());
	assertEquals(getLabel(), m.getColumnCount(), r.getRowCount());
	assertEquals(getLabel(), 1.0, r.getAsDouble(0, 0), TOLERANCE);
	assertEquals(getLabel(), 4.0, r.getAsDouble(0, 1), TOLERANCE);
	assertEquals(getLabel(), 2.0, r.getAsDouble(1, 0), TOLERANCE);
	assertEquals(getLabel(), 5.0, r.getAsDouble(1, 1), TOLERANCE);
	assertEquals(getLabel(), 3.0, r.getAsDouble(2, 0), TOLERANCE);
	assertEquals(getLabel(), 6.0, r.getAsDouble(2, 1), TOLERANCE);
	assertEquals(getLabel(), "label", r.getLabel());
	assertEquals(getLabel(), "row1", r.getColumnLabel(1));
	assertEquals(getLabel(), "col2", r.getRowLabel(2));

	if (m instanceof Erasable) {
		((Erasable) m).erase();
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:30,代码来源:AbstractMatrixTest.java

示例9: get

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Override
public synchronized Matrix get(int index) {
	try {
		connection.setCatalog(getCatalogName());
		DatabaseMetaData meta = connection.getMetaData();
		ResultSet rs = meta.getTables(null, null, "%", null);
		int count = 0;
		String tableName = null;
		while (rs.next()) {
			if (count == index) {
				tableName = rs.getString(3);
				break;
			}
			count++;
		}
		// Matrix tableMatrix = new DenseMySQLMatrix2D(url + "/" +
		// catalogName,
		// "select * from " + tableName, user,
		// password);
		rs.close();
		Matrix m = Matrix.Factory.zeros(10, 10);
		m.setLabel(tableName);
		return m;
	} catch (SQLException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:28,代码来源:JDBCCatalogMatrix.java


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