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

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

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

Matrix.mean介绍

暂无

代码示例

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

public Map<String, Object> calculateObjects(Map<String, Object> input) {
  int dimension = defaultDimension;
  boolean ignoreNaN = defaultIgnoreNaN;
  Map<String, Object> result = new HashMap<String, Object>();
  Matrix source = MathUtil.getMatrix(input.get(SOURCE));
  Object o2 = input.get(DIMENSION);
  if (o2 != null) {
    dimension = MathUtil.getInt(o2);
  }
  Object o3 = input.get(IGNORENAN);
  if (o3 != null) {
    ignoreNaN = MathUtil.getBoolean(o3);
  }
  Matrix target = source.mean(Ret.NEW, dimension, ignoreNaN);
  result.put(TARGET, target);
  return result;
}

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

public Matrix predictOne(Matrix input) {
  List<Matrix> results = new FastArrayList<Matrix>();
  for (Regressor learningAlgorithm : learningAlgorithms) {
    Matrix result = learningAlgorithm.predictOne(input);
    results.add(result);
  }
  Matrix all = Matrix.Factory.vertCat(results);
  Matrix mean = all.mean(Ret.NEW, Matrix.ROW, true);
  return mean;
}

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

public Object call() {
  Matrix result = getMatrixObject().getMatrix().mean(Ret.NEW, getDimension(), getIgnoreMissing());
  return result;
}

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

public Matrix predictOne(Matrix input) {
    List<Sortable<Double, Matrix>> bestResults = new FastArrayList<Sortable<Double, Matrix>>();
    for (Sample s : dataSet) {
      Matrix reference = s.getAsMatrix(getInputLabel());
      double distance = input.euklideanDistanceTo(reference, true);
      if (bestResults.size() < k) {
        bestResults.add(new Sortable<Double, Matrix>(distance, s
            .getAsMatrix(getTargetLabel())));
        Collections.sort(bestResults);
      } else if (distance < bestResults.get(k - 1).getComparable()) {
        bestResults.remove(k - 1);
        bestResults.add(new Sortable<Double, Matrix>(distance, s
            .getAsMatrix(getTargetLabel())));
        Collections.sort(bestResults);
      }
    }
    List<Matrix> results = new FastArrayList<Matrix>();
    for (Sortable<Double, Matrix> s : bestResults) {
      results.add(s.getObject().toColumnVector(Ret.LINK));
    }
    Matrix resultMatrix = Matrix.Factory.vertCat(results);
    Matrix mean = resultMatrix.mean(Ret.NEW, Matrix.ROW, true);
    return mean;
  }
}

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

Matrix columnLabels = m.selectRows(Ret.NEW, 0); // extract label
Matrix mean = data.mean(Ret.NEW, Matrix.ROW, true);
mean.setLabel(m.getLabel() + "-" + benchmarkName + "-mean");
mean.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);

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

public void trainAll(ListDataSet dataSet) {
  featureCount = getFeatureCount(dataSet);
  classCount = getClassCount(dataSet);
  dimensions = featureCount + classCount;
  Matrix x = Matrix.Factory.zeros(dataSet.size(), dimensions);
  int i = 0;
  for (Sample s : dataSet) {
    Matrix input = s.getAsMatrix(getInputLabel()).toColumnVector(Ret.LINK);
    for (int c = 0; c < featureCount; c++) {
      x.setAsDouble(input.getAsDouble(0, c), i, c);
    }
    Matrix target = s.getAsMatrix(getTargetLabel()).toColumnVector(Ret.LINK);
    for (int c = 0; c < classCount; c++) {
      x.setAsDouble(target.getAsDouble(0, c), i, c + featureCount);
    }
    i++;
  }
  meanMatrix = x.mean(Ret.NEW, Matrix.ROW, true);
  covarianceMatrix = x.cov(Ret.NEW, true, true);
  try {
    inverse = covarianceMatrix.inv();
    factor = 1.0 / Math.sqrt(covarianceMatrix.det() * Math.pow(2.0 * Math.PI, dimensions));
  } catch (Exception e) {
    inverse = covarianceMatrix.pinv();
    factor = 1.0;
  }
}

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

mean = x.mean(Ret.NEW, ROW, true);

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

dataSet.setMatrix(Variable.FMEASURE, fmeasure);
Matrix fmeasureMacro = fmeasure.mean(Ret.NEW, Matrix.ALL, false);
dataSet.setMatrix(Variable.FMEASUREMACRO, fmeasureMacro);

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

mean = x.mean(Ret.NEW, ROW, true);

相关文章

Matrix类方法