本文整理了Java中org.ujmp.core.Matrix.selectColumns()
方法的一些代码示例,展示了Matrix.selectColumns()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.selectColumns()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:selectColumns
暂无
代码示例来源:origin: ujmp/universal-java-matrix-package
public void actionPerformed(ActionEvent e) {
try {
Octave.getInstance().plot(matrix.getMatrix().selectColumns(Ret.NEW, 0),
matrix.getMatrix().selectColumns(Ret.NEW, 1), "x");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void actionPerformed(ActionEvent e) {
try {
Matlab.getInstance().plot(matrix.getMatrix().selectColumns(Ret.NEW, 0),
matrix.getMatrix().selectColumns(Ret.NEW, 1));
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void actionPerformed(ActionEvent e) {
try {
Matlab.getInstance().plot(matrix.getMatrix().selectColumns(Ret.NEW, 0),
matrix.getMatrix().selectColumns(Ret.NEW, 1), "x");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void actionPerformed(ActionEvent e) {
try {
Octave.getInstance().plot(matrix.getMatrix().selectColumns(Ret.NEW, 0),
matrix.getMatrix().selectColumns(Ret.NEW, 1));
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
代码示例来源:origin: jdmp/java-data-mining-package
public void trainAll(ListDataSet dataSet) {
reset();
classCount = getClassCount(dataSet);
for (int i = 0; i < classCount; i++) {
System.out.println("Training class " + i);
Classifier c = singleClassClassifier.emptyCopy();
singleClassClassifiers.add(c);
Matrix input = dataSet.getInputMatrix();
Matrix target = dataSet.getTargetMatrix().selectColumns(Ret.LINK, i);
if (twoColumns) {
Matrix target2 = target.minus(1).abs(Ret.NEW);
target = Matrix.Factory.horCat(target, target2);
}
ListDataSet ds = DataSet.Factory.linkToInputAndTarget(input, target);
c.trainAll(ds);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
private static Matrix replaceInColumn(Matrix original, Matrix firstGuess, long column) {
Matrix y = original.selectColumns(Ret.NEW, column);
代码示例来源:origin: ujmp/universal-java-matrix-package
private static Matrix replaceInColumn(Matrix original, Matrix firstGuess, long column) {
Matrix x = firstGuess.deleteColumns(Ret.NEW, column);
Matrix y = original.selectColumns(Ret.NEW, column);
List<Long> missingRows = new ArrayList<Long>();
for (long i = y.getRowCount(); --i >= 0;) {
double v = y.getAsDouble(i, 0);
if (MathUtil.isNaNOrInfinite(v)) {
missingRows.add(i);
}
}
if (missingRows.isEmpty()) {
return y;
}
Matrix xdel = x.deleteRows(Ret.NEW, missingRows);
DenseDoubleMatrix2D bias1 = DenseDoubleMatrix2D.Factory.ones(xdel.getRowCount(), 1);
Matrix xtrain = Matrix.Factory.horCat(xdel, bias1);
Matrix ytrain = y.deleteRows(Ret.NEW, missingRows);
Matrix xinv = xtrain.pinv();
Matrix b = xinv.mtimes(ytrain);
DenseDoubleMatrix2D bias2 = DenseDoubleMatrix2D.Factory.ones(x.getRowCount(), 1);
Matrix yPredicted = Matrix.Factory.horCat(x, bias2).mtimes(b);
// set non-missing values back to original values
for (int row = 0; row < y.getRowCount(); row++) {
double v = y.getAsDouble(row, 0);
if (!Double.isNaN(v)) {
yPredicted.setAsDouble(v, row, 0);
}
}
return yPredicted;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public ExtractAnnotation(Matrix m, int dim) {
super(dim, m);
size = Coordinates.copyOf(m.getSize());
size[dim]--;
setMetaData(new DefaultMapMatrix<String, Object>(new TreeMap<String, Object>()));
getMetaData().put(Matrix.LABEL, m.getLabelObject());
if (dim == ROW) {
MapMatrix<String, Object> a = m.getMetaData();
if (a != null) {
Matrix ai = (Matrix) a.get(Matrix.DIMENSIONMETADATA + COLUMN);
if (ai != null) {
ai = ai.deleteRows(Ret.NEW, 0);
getMetaData().put(Matrix.DIMENSIONMETADATA + COLUMN, ai);
}
}
getMetaData().put(Matrix.DIMENSIONMETADATA + ROW, m.selectRows(Ret.NEW, 0));
} else if (dim == COLUMN) {
MapMatrix<String, Object> a = m.getMetaData();
if (a != null) {
Matrix ai = (Matrix) a.get(Matrix.DIMENSIONMETADATA + ROW);
if (ai != null) {
ai = ai.selectColumns(Ret.NEW, 0);
getMetaData().put(Matrix.DIMENSIONMETADATA + ROW, ai);
}
}
getMetaData().put(Matrix.DIMENSIONMETADATA + COLUMN, m.selectColumns(Ret.NEW, 0));
} else {
throw new RuntimeException("only supported for 2D matrices");
}
}
内容来源于网络,如有侵权,请联系作者删除!