/** * converts the Matrix into a single line Matlab string: matrix is enclosed by * parentheses, rows are separated by semicolon and single cells by blanks, * e.g., [1 2; 3 4]. * * @return the matrix in Matlab single line format */ public String toMatlab() { return getMatrix().toMatlab(); }
/** * Performs a (ridged) linear regression. * * @param y the dependent variable vector * @param ridge the ridge parameter * @return the coefficients * @throws IllegalArgumentException if not successful */ public final double[] regression(Matrix y, double ridge) { return getMatrix().regression(y.getMatrix(), ridge).getCoefficients(); }
/** * Performs a (ridged) linear regression. * * @param y the dependent variable vector * @param ridge the ridge parameter * @return the coefficients * @throws IllegalArgumentException if not successful */ public final double[] regression(Matrix y, double ridge) { return getMatrix().regression(y.getMatrix(), ridge).getCoefficients(); }
/** * converts the Matrix into a single line Matlab string: matrix is enclosed by * parentheses, rows are separated by semicolon and single cells by blanks, * e.g., [1 2; 3 4]. * * @return the matrix in Matlab single line format */ public String toMatlab() { return getMatrix().toMatlab(); }
/** * Performs a weighted (ridged) linear regression. * * @param y the dependent variable vector * @param w the array of data point weights * @param ridge the ridge parameter * @return the coefficients * @throws IllegalArgumentException if the wrong number of weights were * provided. */ public final double[] regression(Matrix y, double[] w, double ridge) { return getMatrix().regression(y.getMatrix(), w, ridge).getCoefficients(); }
/** * Performs a weighted (ridged) linear regression. * * @param y the dependent variable vector * @param w the array of data point weights * @param ridge the ridge parameter * @return the coefficients * @throws IllegalArgumentException if the wrong number of weights were * provided. */ public final double[] regression(Matrix y, double[] w, double ridge) { return getMatrix().regression(y.getMatrix(), w, ridge).getCoefficients(); }
/** * Returns the sum of this matrix with another. * * @return a matrix containing the sum. */ public final Matrix add(Matrix other) { try { return new Matrix(m_Matrix.plus(other.getMatrix()).getArrayCopy()); } catch (Exception e) { e.printStackTrace(); return null; } }
/** * Returns the sum of this matrix with another. * * @return a matrix containing the sum. */ public final Matrix add(Matrix other) { try { return new Matrix(m_Matrix.plus(other.getMatrix()).getArrayCopy()); } catch (Exception e) { e.printStackTrace(); return null; } }