Package org.encog.mathutil.matrices

Examples of org.encog.mathutil.matrices.Matrix


  private double[][][] CreateCoefficients(final int points) {
    final double[][][] coefficients = new double[points][points][points];

    for (int i = 0; i < points; i++) {
      final Matrix delts = new Matrix(points, points);
      final double[][] ptr = delts.getData();

      for (int j = 0; j < points; j++) {
        final double delt = (j - i);
        double hterm = 1.0;

        for (int k = 0; k < points; k++) {
          ptr[j][k] = hterm / EncogMath.factorial(k);
          hterm *= delt;
        }
      }

      final Matrix invMatrix = delts.inverse();
      final double dNumPointsFactorial = EncogMath.factorial(points);

      for (int j = 0; j < points; j++) {
        for (int k = 0; k < points; k++) {
          coefficients[i][j][k] = (Math
              .round(invMatrix.getData()[j][k]
                  * dNumPointsFactorial))
              / dNumPointsFactorial;
        }
      }
    }
View Full Code Here


   */
  public SOM(final int inputCount, final int outputCount) {

    this.inputNeuronCount = inputCount;
    this.outputNeuronCount = outputCount;
    this.weights = new Matrix(inputCount, outputCount);
  }
View Full Code Here

  public final MLData compute(final MLData input) {

    final MLData result = new BasicMLData(this.outputNeuronCount);

    for (int i = 0; i < this.outputNeuronCount; i++) {
      final Matrix optr = this.weights.getCol(i);
      final Matrix inputMatrix = Matrix.createRowMatrix(input.getData());
      result.setData(i, MatrixMath.dotProduct(inputMatrix, optr));
    }

    return result;
  }
View Full Code Here

    this.outputNeuronCount = network.getOutputNeuronCount();
    this.forceWinner = false;
    setError(0);

    // setup the correction matrix
    this.correctionMatrix = new Matrix(this.inputNeuronCount,
        this.outputNeuronCount);

    // create the BMU class
    this.bmuUtil = new BestMatchingUnit(network);
  }
View Full Code Here

    final double[] d = NumberList.fromList(CSVFormat.EG_FORMAT, line);
    final int rows = (int) d[0];
    final int cols = (int) d[1];

    final Matrix result = new Matrix(rows, cols);

    int index = 2;
    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < cols; c++) {
        result.set(r, c, d[index++]);
      }
    }

    return result;
  }
View Full Code Here

    final MLDataSet training = new BasicMLDataSet(
        TestCompetitive.SOM_INPUT, null);

    // Create the neural network.
    SOM network = new SOM(4,2);   
    network.setWeights(new Matrix(MATRIX_ARRAY));

    final BasicTrainSOM train = new BasicTrainSOM(network, 0.4,
        training, new NeighborhoodSingle());
    train.setForceWinner(true);
    int iteration = 0;
View Full Code Here

   */
  public BAM(final int theF1Count, final int theF2Count) {
    this.f1Count = theF1Count;
    this.f2Count = theF2Count;

    this.weightsF1toF2 = new Matrix(f1Count, f2Count);
    this.weightsF2toF1 = new Matrix(f2Count, f1Count);
  }
View Full Code Here

    EncogFileSection section;
    int inputCount = 0;
    int instarCount = 0;
    int outputCount = 0;
    int winnerCount = 0;
    Matrix m1 = null;
    Matrix m2 = null;

    while ((section = in.readNextSection()) != null) {
      if (section.getSectionName().equals("CPN")
          && section.getSubSectionName().equals("PARAMS")) {
        networkParams = section.parseParams();
View Full Code Here

   *
   * @return Lower trapezoidal matrix whose columns define the reflections
   */

  public Matrix getH() {
    Matrix X = new Matrix(m, n);
    double[][] H = X.getData();
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < n; j++) {
        if (i >= j) {
          H[i][j] = QR[i][j];
        } else {
View Full Code Here

   *
   * @return R
   */

  public Matrix getR() {
    Matrix X = new Matrix(n, n);
    double[][] R = X.getData();
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i < j) {
          R[i][j] = QR[i][j];
        } else if (i == j) {
View Full Code Here

TOP

Related Classes of org.encog.mathutil.matrices.Matrix

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.