org.ujmp.core.Matrix.doubleValue()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.ujmp.core.Matrix.doubleValue()方法的一些代码示例,展示了Matrix.doubleValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.doubleValue()方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:doubleValue

Matrix.doubleValue介绍

暂无

代码示例

代码示例来源:origin: ujmp/universal-java-matrix-package

public int compareTo(Matrix m) {
  double v1 = doubleValue();
  double v2 = m.doubleValue();
  return new Double(v1).compareTo(v2);
}

代码示例来源:origin: jdmp/java-data-mining-package

public Map<String, Object> calculateObjects(Map<String, Object> input) {
    Map<String, Object> result = new HashMap<String, Object>();

    Matrix source1 = MathUtil.getMatrix(input.get(SOURCE1));
    Matrix source2 = MathUtil.getMatrix(input.get(SOURCE2));

    result.put(TARGET,
        Matrix.Factory.zeros((long) source1.doubleValue(), (long) source2.doubleValue()));

    return result;

  }
}

代码示例来源:origin: jdmp/java-data-mining-package

public Map<String, Object> calculateObjects(Map<String, Object> input) {
    Map<String, Object> result = new HashMap<String, Object>();

    Matrix source1 = MathUtil.getMatrix(input.get(SOURCE1));
    Matrix source2 = MathUtil.getMatrix(input.get(SOURCE2));

    result.put(TARGET,
        Matrix.Factory.rand((long) source1.doubleValue(), (long) source2.doubleValue()));

    return result;

  }
}

代码示例来源:origin: jdmp/java-data-mining-package

public Map<String, Object> calculateObjects(Map<String, Object> input) {
    Map<String, Object> result = new HashMap<String, Object>();

    Matrix source1 = MathUtil.getMatrix(input.get(SOURCE1));
    Matrix source2 = MathUtil.getMatrix(input.get(SOURCE2));

    result.put(TARGET,
        Matrix.Factory.ones((long) source1.doubleValue(), (long) source2.doubleValue()));

    return result;

  }
}

代码示例来源:origin: jdmp/java-data-mining-package

public Map<String, Object> calculateObjects(Map<String, Object> input) {
    Map<String, Object> result = new HashMap<String, Object>();

    Matrix source1 = MathUtil.getMatrix(input.get(SOURCE1));
    Matrix source2 = MathUtil.getMatrix(input.get(SOURCE2));

    result.put(TARGET,
        Matrix.Factory.randn((long) source1.doubleValue(), (long) source2.doubleValue()));

    return result;

  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public static final double getDouble(final Object o) {
  if (o == null) {
    return 0.0;
  } else if (o instanceof Double) {
    return (Double) o;
  } else if (o instanceof Date) {
    return ((Date) o).getTime();
  } else if (o instanceof Matrix) {
    return ((Matrix) o).doubleValue();
  } else {
    if ("true".equalsIgnoreCase(o.toString())) {
      return 1.0;
    }
    if ("false".equalsIgnoreCase(o.toString())) {
      return 0.0;
    }
    try {
      return Double.parseDouble(o.toString());
    } catch (Exception e) {
    }
  }
  return Double.NaN;
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public double getDouble(String label) throws Exception {
  Matrix m = getMatrix(label);
  VerifyUtil.verifySingleValue(m);
  return m.doubleValue();
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public double getDouble(String label) throws Exception {
  Matrix m = getMatrix(label);
  VerifyUtil.verifySingleValue(m);
  return m.doubleValue();
}

代码示例来源:origin: jdmp/java-data-mining-package

public double getLearningRate() {
  return getVariableMap().getMatrix(ETA).doubleValue();
}

代码示例来源:origin: jdmp/java-data-mining-package

public double getDensity(Matrix input) {
  Matrix xmean = input.minus(meanMatrix);
  Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
  return factor * Math.exp(-0.5 * matrix.doubleValue());
}

代码示例来源:origin: jdmp/java-data-mining-package

public double getDensityUnscaled(Matrix input) {
  Matrix xmean = input.minus(meanMatrix);
  Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
  return Math.exp(-0.5 * matrix.doubleValue());
}

代码示例来源:origin: jdmp/java-data-mining-package

public static double getDensity(Matrix x, Matrix mean, Matrix covariance) {
  Matrix xmean = x.minus(mean);
  Matrix inverse = covariance.inv();
  double f = 1.0 / Math.sqrt(covariance.det() * Math.pow(2.0 * Math.PI, x.getColumnCount()));
  Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
  return f * Math.exp(-0.5 * matrix.doubleValue());
}

代码示例来源:origin: jdmp/java-data-mining-package

public static double getDensityUnscaled(Matrix x, Matrix mean, Matrix covariance) {
  Matrix xmean = x.minus(mean);
  Matrix inverse = covariance.inv();
  Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
  return Math.exp(-0.5 * matrix.doubleValue());
}

代码示例来源:origin: jdmp/java-data-mining-package

public void trainOne(Matrix input, Matrix sampleWeight, Matrix desiredOutput) {
  addDesiredOutputMatrix(desiredOutput.toRowVector(Ret.NEW));
  if (sampleWeight == null) {
    sampleWeight = Matrix.Factory.linkToValue(1.0);
  }
  setSampleWeight(sampleWeight.doubleValue());
  predictOne(input);
  getOutputErrorAlgorithm().calculate();
  for (int i = networkLayers.size() - 1; i != -1; i--) {
    networkLayers.get(i).calculateBackward();
  }
  for (int i = networkLayers.size() - 1; i != -1; i--) {
    networkLayers.get(i).calculateWeightUpdate();
  }
}

代码示例来源:origin: jdmp/java-data-mining-package

private Object getSingleValue(PExpression expression) throws Exception {
  Matrix m = MathUtil.getMatrix(getObject(expression));
  if (m.isScalar()) {
    return m.getAsObject(0, 0);
  } else {
    return m.doubleValue();
  }
}

代码示例来源:origin: jdmp/java-data-mining-package

double eta = MathUtil.getMatrix(matrices.get(ETA)).doubleValue();
Matrix contactDeviation = MathUtil.getMatrix(matrices.get(CONTACTDEVIATION));
double sampleWeight = MathUtil.getMatrix(matrices.get(SAMPLEWEIGHT)).doubleValue();
double missingValueCount = transposedInput.countMissing(Ret.NEW, ALL).doubleValue();

代码示例来源:origin: jdmp/java-data-mining-package

System.out.println("Accuracy: " + allacc.getMeanValue() + "+-" + stdacc.doubleValue());
  Matrix stdfm = allfm.std(Ret.NEW, Matrix.ROW, false, true);
  System.out.println("F-Measure (macro): " + allfm.getMeanValue() + "+-"
      + stdfm.doubleValue());
  Matrix stdsens = allsens.std(Ret.NEW, Matrix.ROW, false, true);
  System.out.println("Sensitivity: " + allsens.getMeanValue() + "+-"
      + stdsens.doubleValue());
  Matrix stdspec = allspec.std(Ret.NEW, Matrix.ROW, false, true);
  System.out.println("Specificity: " + allspec.getMeanValue() + "+-"
      + stdspec.doubleValue());
  Matrix stdprec = allprec.std(Ret.NEW, Matrix.ROW, false, true);
  System.out.println("Precision: " + allprec.getMeanValue() + "+-"
      + stdprec.doubleValue());
  Matrix stdrec = allrec.std(Ret.NEW, Matrix.ROW, false, true);
  System.out.println("Recall: " + allrec.getMeanValue() + "+-" + stdrec.doubleValue());
  Matrix stdrmse = allrmse.std(Ret.NEW, Matrix.ROW, false, true);
  System.out.println("RMSE: " + allrmse.getMeanValue() + "+-" + stdrmse.doubleValue());
} else {
  System.out.println("Accuracy: " + allacc.getMeanValue());

代码示例来源:origin: jdmp/java-data-mining-package

public SampleToInstanceWrapper(Matrix input, Matrix sampleWeight, Matrix targetOutput,
    boolean discrete, boolean includeTarget) {
  super((int) input.toRowVector(Ret.LINK).getRowCount() + 1);
  input = input.toRowVector(Ret.LINK);
  if (sampleWeight != null) {
    setWeight(sampleWeight.doubleValue());
  } else {
    setWeight(1.0);
  }
  for (int i = 0; i < input.getRowCount(); i++) {
    if (discrete) {
      setValue(i, (int) input.getAsDouble(i, 0));
    } else {
      setValue(i, input.getAsDouble(i, 0));
    }
  }
  if (includeTarget && targetOutput != null) {
    long[] c = targetOutput.toRowVector(Ret.NEW).getCoordinatesOfMaximum();
    setValue((int) input.getRowCount(), c[Matrix.ROW]);
  }
}

代码示例来源:origin: jdmp/java-data-mining-package

Matrix m = s.getAsMatrix("RMSE");
  if (m != null) {
    double sampleRMSE = m.doubleValue();
    sumRMSE += sampleRMSE;
    if (sampleRMSE > maxRMSE) {
System.out.println("Iteration: " + iteration + ", RMSE: " + rmse.doubleValue()
    + ", errors: " + errorCount + ", accuracy: " + accuracy.doubleValue());

相关文章

Matrix类方法