Examples of DoubleMatrix


Examples of de.jungblut.math.DoubleMatrix

  @Override
  public void train(DoubleVector[] features, DoubleVector[] outcome) {
    Preconditions.checkArgument(features.length == outcome.length,
        "Features and Outcomes need to match in length!");
    DoubleMatrix x = null;
    DoubleMatrix y = null;
    // add the bias
    if (features[0].isSparse()) {
      x = new SparseDoubleRowMatrix(DenseDoubleVector.ones(features.length),
          new SparseDoubleRowMatrix(features));
    } else {
      x = new DenseDoubleMatrix(DenseDoubleVector.ones(features.length),
          new DenseDoubleMatrix(features));
    }
    if (outcome[0].isSparse()) {
      y = new SparseDoubleRowMatrix(outcome);
    } else {
      y = new DenseDoubleMatrix(outcome);
    }
    // transpose y to get a faster lookup in the cost function
    y = y.transpose();

    LogisticRegressionCostFunction cnf = new LogisticRegressionCostFunction(x,
        y, lambda);

    // random init theta
    theta = new DenseDoubleVector(x.getColumnCount() * y.getRowCount());
    for (int i = 0; i < theta.getDimension(); i++) {
      theta.set(i, (random.nextDouble() * 2) - 1d);
    }
    theta = minimizer.minimize(cnf, theta, numIterations, verbose);
  }
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

  private boolean isWrite = false;


  public DoubleImageRandomDataSource() {
        super(null);
    matrice = new DoubleMatrix();
    matrice.setName("Random Image");
    Thread thread = new Thread(){
      @Override
      public void run(){
        while (!isWrite) {
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                }
            }
        }

        try {
            AbstractNumberMatrix<?> matrix = new DoubleMatrix();
            int[] shape = data.getShape();
            if (shape.length == 2) {
                matrix.setFlatValue(finalData, shape[0], shape[1]);
            }
            table.setData(matrix);

            // viewer.setAnnotation(IChartViewer.TIME_ANNO, IChartViewer.Y1);
            Map<String, Object> dataToChart = new HashMap<String, Object>();
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

            Data doubleMatrixData = input;

            Object inputVal = input.getValue();
            if (inputVal instanceof DoubleMatrix) {
                DoubleMatrix inputValMatrix = (DoubleMatrix) inputVal;

                scalarVal = inputValMatrix.getValueAt(120, 115);

                double[][] doubleMatrix = (double[][]) ((DoubleMatrix) inputVal).getValue();

                double[] arrayValue = doubleMatrix[120];
                double[] result = new double[arrayValue.length];
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                    TangoAttribute tangoAttribute = new TangoAttribute(scanServerDeviceName + "/" + attributeName);
                    double[] doubleValues = (double[]) tangoAttribute.readArray(Double.TYPE);
                    int dimX = tangoAttribute.getDimX();
                    int dimY = tangoAttribute.getDimY();
                    if ((doubleValues != null) && (x < dimX) && (y < dimY)) {
                        DoubleMatrix matrix = new DoubleMatrix();
                        matrix.setFlatValue(doubleValues, dimY, dimX);
                        value = matrix.getValueAt(y, x);
                    }
                } catch (DevFailed e) {
                    e.printStackTrace();
                } catch (UnsupportedDataTypeException e) {
                    e.printStackTrace();
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                            + attributeName);
                    double[] doubleValues = (double[]) tangoAttribute.readArray(Double.TYPE);
                    int dimX = tangoAttribute.getDimX();
                    int dimY = tangoAttribute.getDimY();
                    if (doubleValues != null && x < dimX && y < dimY) {
                        DoubleMatrix matrix = new DoubleMatrix();
                        matrix.setFlatValue(doubleValues, dimY, dimX);
                        value = matrix.getValueAt(y, x);
                    }
                }
                catch (DevFailed e) {
                    e.printStackTrace();
                }
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                            + attributeName);
                    double[] doubleValues = (double[]) tangoAttribute.readArray(Double.TYPE);
                    int dimX = tangoAttribute.getDimX();
                    int dimY = tangoAttribute.getDimY();
                    if (doubleValues != null && x < dimX && y < dimY) {
                        DoubleMatrix matrix = new DoubleMatrix();
                        matrix.setFlatValue(doubleValues, dimY, dimX);
                        value = matrix.getValueAt(y, x);
                    }
                }
                catch (DevFailed e) {
                    e.printStackTrace();
                }
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                    TangoAttribute tangoAttribute = new TangoAttribute(scanServerDeviceName + "/" + attributeName);
                    doubleValues = (double[]) tangoAttribute.readArray(Double.TYPE);
                    int dimX = tangoAttribute.getDimX();
                    int dimY = tangoAttribute.getDimY();
                    if ((doubleValues != null) && (x < dimX) && (y < dimY)) {
                        DoubleMatrix matrix = new DoubleMatrix();
                        matrix.setFlatValue(doubleValues, dimY, dimX);
                        value = matrix.getValueAt(y, x);
                    }
                } catch (DevFailed e) {
                    LOGGER.error("Cannot read " + scanServerDeviceName + "/" + attributeName + " "
                            + DevFailedUtils.toString(e));
                } catch (UnsupportedDataTypeException e) {
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                            + attributeName);
                    double[] doubleValues = (double[]) tangoAttribute.readArray(Double.TYPE);
                    int dimX = tangoAttribute.getDimX();
                    int dimY = tangoAttribute.getDimY();
                    if (doubleValues != null && x < dimX && y < dimY) {
                        DoubleMatrix matrix = new DoubleMatrix();
                        matrix.setFlatValue(doubleValues, dimY, dimX);
                        value = matrix.getValueAt(y, x);
                    }
                }
                catch (DevFailed e) {
                    e.printStackTrace();
                }
View Full Code Here

Examples of fr.soleil.data.container.matrix.DoubleMatrix

                    TangoAttribute tangoAttribute = new TangoAttribute(scanServerDeviceName + "/" + attributeName);
                    double[] doubleValues = (double[]) tangoAttribute.readArray(Double.TYPE);
                    int dimX = tangoAttribute.getDimX();
                    int dimY = tangoAttribute.getDimY();
                    if ((doubleValues != null) && (x < dimX) && (y < dimY)) {
                        DoubleMatrix matrix = new DoubleMatrix();
                        matrix.setFlatValue(doubleValues, dimY, dimX);
                        value = matrix.getValueAt(y, x);
                    }
                } catch (DevFailed e) {
                    e.printStackTrace();
                } catch (UnsupportedDataTypeException e) {
                    e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.