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

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

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

Matrix.getValueSum介绍

暂无

代码示例

代码示例来源:origin: davidandrzej/LogicLDA

public double alphaSum()
  {
    return matalpha.getValueSum();		
  }
}

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

public static final double accuracy(Matrix confusionMatrix) {
  VerifyUtil.verifySquare(confusionMatrix);
  return totalCorrect(confusionMatrix) / confusionMatrix.getValueSum();
}

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

public Matrix predictOne(Matrix input) {
  // TODO: check
  Matrix result = super.predictOne(input);
  result = result.logistic(Ret.NEW);
  double sum = result.getValueSum();
  if (sum > 0) {
    result = result.divide(sum);
  }
  return result;
}

代码示例来源:origin: davidandrzej/LogicLDA

(matbeta.subMatrix(Ret.LINK,j,0,j,W-1)).getValueSum();

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

public static final Language guess(String string) {
  double bestSim = 0;
  Language bestLanguage = null;
  for (Language lang : values()) {
    Matrix count = TextUtil.getCharacterBigramFrequencies(string, lang.getAlphabet());
    double sum = count.getValueSum();
    Matrix freq = count.divide(Ret.NEW, true, sum).log(Ret.NEW);
    // add NaN where value is 0 to compare only found letters
    // for (long[] c : freq.allCoordinates()) {
    // if (freq.getAsDouble(c) == 0) {
    // freq.setAsDouble(Double.NaN, c);
    // } else {
    // System.out.println(freq.getAsDouble(c));
    // }
    // }
    double sim = freq.cosineSimilarityTo(lang.getCharacterBigramFrequencies().log(Ret.NEW),
        true);
    System.out.println(lang + ": " + sim);
    if (sim > bestSim) {
      bestSim = sim;
      bestLanguage = lang;
    }
  }
  return bestLanguage;
}

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

Matrix squared = diff.power(Ret.NEW, 2);
double rmse = Math.sqrt(squared.getValueSum() / squared.getValueCount());
double improvement = Math.abs(lastRmse - rmse);
if (MathUtil.isNaNOrInfinite(averageImprovement)) {

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

@Test
public void testMatrixDot() {
  Matrix matrix1 = Matrix.Factory.zeros(M1COLS, M1COLS);
  for (int i = 0; i < M1COLS; i++) {
    matrix1.setAsDouble(1, i, i);
  }
  Matrix matrix2 = Matrix.Factory.zeros(M1COLS, M1COLS);
  for (int i = 0; i < M1COLS; i++) {
    matrix2.setAsDouble(1, i, i);
  }
  double result = matrix1.mtimes(matrix2).getValueSum();
  assertEquals(M1COLS, result, 0.0001);
}

相关文章

Matrix类方法