本文整理了Java中org.ujmp.core.Matrix.setLabel()
方法的一些代码示例,展示了Matrix.setLabel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.setLabel()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:setLabel
暂无
代码示例来源:origin: ujmp/universal-java-matrix-package
public final void setDescription(final String description) {
matrix.setLabel(description);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final void setLabel(final Object label) {
matrix.setLabel(label);
}
代码示例来源:origin: ujmp/universal-java-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;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final void setDimensionLabel(int dimension, Object label) {
if (metaData == null) {
metaData = new DefaultMapMatrix<String, Object>(new TreeMap<String, Object>());
}
Matrix m = getMetaDataDimensionMatrix(dimension);
m.setLabel(label);
}
代码示例来源:origin: org.ujmp/ujmp-jdbc
@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);
}
}
代码示例来源:origin: ujmp/universal-java-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);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
Node n = channel.getChildNodes().item(c);
if (n.getNodeName().equalsIgnoreCase("title")) {
m.setLabel(n.getTextContent());
代码示例来源:origin: ujmp/universal-java-matrix-package
Node n = channel.getChildNodes().item(c);
if (n.getNodeName().equalsIgnoreCase("title")) {
m.setLabel(n.getTextContent());
代码示例来源:origin: jdmp/java-data-mining-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);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
String benchmarkName = r.getName().replaceAll(".csv", "");
Matrix data = Matrix.Factory.importFrom().file(r).asDenseCSV();
data.setLabel(matrixName);
List<Matrix> list = statistics.get(benchmarkName);
if (list == null) {
mean.setLabel(m.getLabel() + "-" + benchmarkName + "-mean");
mean.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
means.add(mean);
std.setLabel(m.getLabel() + "-" + benchmarkName + "-std");
std.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
stds.add(std);
min.setLabel(m.getLabel() + "-" + benchmarkName + "-min");
min.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
mins.add(min);
max.setLabel(m.getLabel() + "-" + benchmarkName + "-max");
max.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
maxs.add(max);
try {
allmeans = Matrix.Factory.vertCat(means);
allmeans.setLabel(benchmarkName + "-mean");
ListMatrix<String> matrixLabels = new DefaultListMatrix<String>();
for (Matrix m : means) {
perCell.setLabel(allmeans.getLabel() + "-percell");
代码示例来源:origin: ujmp/universal-java-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));
}
代码示例来源:origin: ujmp/universal-java-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);
}
}
代码示例来源:origin: jdmp/java-data-mining-package
rmse.setLabel("RMSE with " + getLabel());
dataSet.setMatrix(Variable.RMSE, rmse);
confusion.setLabel("Confusion with " + getLabel());
dataSet.setMatrix(Variable.CONFUSION, confusion);
accuracy.setLabel("Accuracy with " + getLabel());
dataSet.setMatrix(Variable.ACCURACY, accuracy);
errorMatrix.setLabel("Errors with " + getLabel());
dataSet.setMatrix(Variable.ERRORCOUNT, errorMatrix);
代码示例来源:origin: ujmp/universal-java-matrix-package
plt.setColumnLabel(c, matrix.getColumnLabel(c - 1));
plt.setLabel(matrix.getLabel());
Object[] params = null;
if (matrix.getLabel().contains("stdpercent")) {
代码示例来源:origin: ujmp/universal-java-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));
}
代码示例来源:origin: ujmp/universal-java-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));
}
代码示例来源:origin: ujmp/universal-java-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();
}
}
代码示例来源:origin: ujmp/universal-java-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();
}
}
内容来源于网络,如有侵权,请联系作者删除!