Tabnine Logo
DoubleMatrix.setColumnVector
Code IndexAdd Tabnine to your IDE (free)

How to use
setColumnVector
method
in
de.jungblut.math.DoubleMatrix

Best Java code snippets using de.jungblut.math.DoubleMatrix.setColumnVector (Showing top 5 results out of 315)

origin: de.jungblut.math/tjungblut-math

@Override
public DoubleMatrix slice(int rowOffset, int rowMax, int colOffset, int colMax) {
 DoubleMatrix m = new SparseDoubleRowMatrix(rowMax - rowOffset, colMax
   - colOffset);
 for (int col : columnIndices()) {
  DoubleVector columnVector = getColumnVector(col);
  columnVector = columnVector.slice(rowOffset, rowMax);
  m.setColumnVector(col - colOffset, columnVector);
 }
 return m;
}
origin: de.jungblut.math/tjungblut-math

@Override
public DoubleMatrix divide(DoubleVector vec) {
 DoubleMatrix cop = new DenseDoubleMatrix(this.getRowCount(),
   this.getColumnCount());
 for (int i = 0; i < this.getColumnCount(); i++) {
  cop.setColumnVector(i, getColumnVector(i).divide(vec));
 }
 return cop;
}
origin: de.jungblut.common/thomasjungblut-common

public static void calculateGradients(DoubleMatrix[] thetas,
                   DoubleMatrix[] thetaGradients, DoubleMatrix[] ax, DoubleMatrix[] deltaX,
                   final int m, NetworkConfiguration conf) {
  // calculate the gradients of the weights
  for (int i = 0; i < thetaGradients.length; i++) {
    DoubleMatrix gradDXA = multiply(deltaX[i + 1], ax[i], true, false, conf);
    if (m != 1) {
      thetaGradients[i] = gradDXA.divide(m);
    } else {
      thetaGradients[i] = gradDXA;
    }
    if (conf.lambda != 0d) {
      thetaGradients[i] = thetaGradients[i].add((thetas[i]
          .multiply(conf.lambda / m)));
      // subtract the regularized bias
      DoubleVector regBias = thetas[i]
          .slice(0, thetas[i].getRowCount(), 0, 1).multiply(conf.lambda / m)
          .getColumnVector(0);
      thetaGradients[i].setColumnVector(0, regBias);
    }
  }
}
origin: de.jungblut.common/thomasjungblut-common

@Override
public DoubleMatrix gradient(DoubleMatrix matrix) {
  DoubleMatrix newInstance = newInstance(matrix);
  if (matrix.isSparse()) {
    // if we have a sparse matrix, it is more efficient to loop over the
    // sparse column vectors
    int[] columnIndices = matrix.columnIndices();
    for (int col : columnIndices) {
      newInstance.setColumnVector(col, gradient(matrix.getColumnVector(col)));
    }
  } else {
    // on dense matrices we can be faster by directly looping over the items
    for (int i = 0; i < matrix.getRowCount(); i++) {
      for (int j = 0; j < matrix.getColumnCount(); j++) {
        newInstance.set(i, j, gradient(matrix.get(i, j)));
      }
    }
  }
  return newInstance;
}
origin: de.jungblut.common/thomasjungblut-common

    theta, false, false));
positiveHiddenProbs.setColumnVector(0,
    DenseDoubleVector.ones(positiveHiddenProbs.getRowCount()));
DoubleMatrix positiveAssociations = multiply(data, positiveHiddenProbs,
negativeData.setColumnVector(0,
    DenseDoubleVector.ones(negativeData.getRowCount()));
DoubleMatrix negativeHiddenProbs = activationFunction.apply(multiply(
    negativeData, theta, false, false));
negativeHiddenProbs.setColumnVector(0,
    DenseDoubleVector.ones(negativeHiddenProbs.getRowCount()));
DoubleMatrix negativeAssociations = multiply(negativeData,
  thetaGradient = thetaGradient.subtract(thetaGradient.multiply(lambda
      / data.getRowCount()));
  thetaGradient.setColumnVector(0, bias);
de.jungblut.mathDoubleMatrixsetColumnVector

Javadoc

Sets a whole column at index col with the given vector.

Popular methods of DoubleMatrix

  • get
    Get a specific value of the matrix.
  • getColumnCount
    Returns the number of columns in the matrix. Always a constant time operation.
  • getRowVector
    Get a single row of the matrix as a vector.
  • set
    Sets the value at the given row and column index.
  • columnIndices
  • getColumnVector
    Get a whole column of the matrix as vector.
  • getRowCount
    Returns the number of rows in this matrix. Always a constant time operation.
  • setRowVector
    Sets the whole row at index rowIndex with the given vector.
  • add
    Adds the elements in the given matrix to the elements in this matrix.
  • deepCopy
  • divide
    Divides each element in a column by the related element in the given vector.
  • isSparse
  • divide,
  • isSparse,
  • multiply,
  • multiplyElementWise,
  • multiplyVectorRow,
  • pow,
  • rowIndices,
  • slice,
  • subtract

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JCheckBox (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now