org.apache.mahout.math.Vector.maxValue()方法的使用及代码示例

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

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

Vector.maxValue介绍

暂无

代码示例

代码示例来源:origin: apache/mahout

@Override
public double maxValue() {
 return delegate.maxValue();
}

代码示例来源:origin: apache/mahout

double max = vec1.maxValue();
assertEquals(-1.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, EPSILON);
max = vec1.maxValue();
assertEquals(0.0, max, EPSILON);
max = vec1.maxValue();
assertEquals(0.0, max, EPSILON);
max = vec1.maxValue();
assertEquals(Double.NEGATIVE_INFINITY, max, EPSILON);
max = vec1.maxValue();
assertEquals(Double.NEGATIVE_INFINITY, max, EPSILON);
max = vec1.maxValue();
assertEquals(Double.NEGATIVE_INFINITY, max, EPSILON);

代码示例来源:origin: apache/mahout

vec1.setQuick(2, -2);
max = vec1.maxValue();
assertEquals(0.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, 0.0);
max = vec1.maxValue();
assertEquals(0.0, max, EPSILON);
max = vec1.maxValue();
assertEquals(0.0, max, EPSILON);
max = vec1.maxValue();
assertEquals(0.0, max, EPSILON);
max = vec1.maxValue();
assertEquals(Double.NEGATIVE_INFINITY, max, EPSILON);
max = vec1.maxValue();
assertEquals(Double.NEGATIVE_INFINITY, max, EPSILON);
max = vec1.maxValue();
assertEquals(Double.NEGATIVE_INFINITY, max, EPSILON);

代码示例来源:origin: apache/mahout

@Override
public double maxValue() {
 return delegate.maxValue();
}

代码示例来源:origin: apache/mahout

assertEquals(dv1.minValueIndex(), v1.minValueIndex());
assertEquals(dv1.maxValue(), v1.maxValue(), FUZZ);
assertEquals(dv1.maxValueIndex(), v1.maxValueIndex());

代码示例来源:origin: org.apache.mahout/mahout-mr

/**
 * Decides whether the vector should be classified or not based on the max pdf
 * value of the clusters and threshold value.
 * 
 * @return whether the vector should be classified or not.
 */
private static boolean shouldClassify(Vector pdfPerCluster, Double clusterClassificationThreshold) {
 return pdfPerCluster.maxValue() >= clusterClassificationThreshold;
}

代码示例来源:origin: org.apache.mahout/mahout-core

private static void classifyAndWrite(List<Cluster> clusterModels, Double clusterClassificationThreshold,
  boolean emitMostLikely, SequenceFile.Writer writer, VectorWritable vw, Vector pdfPerCluster) throws IOException {
 Map<Text, Text> props = Maps.newHashMap();
 if (emitMostLikely) {
  int maxValueIndex = pdfPerCluster.maxValueIndex();
  WeightedPropertyVectorWritable weightedPropertyVectorWritable =
    new WeightedPropertyVectorWritable(pdfPerCluster.maxValue(), vw.get(), props);
  write(clusterModels, writer, weightedPropertyVectorWritable, maxValueIndex);
 } else {
  writeAllAboveThreshold(clusterModels, clusterClassificationThreshold, writer, vw, pdfPerCluster);
 }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

/**
 * Decides whether the vector should be classified or not based on the max pdf
 * value of the clusters and threshold value.
 * 
 * @return whether the vector should be classified or not.
 */
private static boolean shouldClassify(Vector pdfPerCluster, Double clusterClassificationThreshold) {
 return pdfPerCluster.maxValue() >= clusterClassificationThreshold;
}

代码示例来源:origin: org.apache.mahout/mahout-mr

private static void classifyAndWrite(List<Cluster> clusterModels, Double clusterClassificationThreshold,
  boolean emitMostLikely, SequenceFile.Writer writer, VectorWritable vw, Vector pdfPerCluster) throws IOException {
 Map<Text, Text> props = new HashMap<>();
 if (emitMostLikely) {
  int maxValueIndex = pdfPerCluster.maxValueIndex();
  WeightedPropertyVectorWritable weightedPropertyVectorWritable =
    new WeightedPropertyVectorWritable(pdfPerCluster.maxValue(), vw.get(), props);
  write(clusterModels, writer, weightedPropertyVectorWritable, maxValueIndex);
 } else {
  writeAllAboveThreshold(clusterModels, clusterClassificationThreshold, writer, vw, pdfPerCluster);
 }
}

代码示例来源:origin: org.apache.mahout/mahout-core

/**
 * Decides whether the vector should be classified or not based on the max pdf
 * value of the clusters and threshold value.
 * 
 * @return whether the vector should be classified or not.
 */
private static boolean shouldClassify(Vector pdfPerCluster, Double clusterClassificationThreshold) {
 return pdfPerCluster.maxValue() >= clusterClassificationThreshold;
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

private static void classifyAndWrite(List<Cluster> clusterModels, Double clusterClassificationThreshold,
  boolean emitMostLikely, SequenceFile.Writer writer, VectorWritable vw, Vector pdfPerCluster) throws IOException {
 Map<Text, Text> props = Maps.newHashMap();
 if (emitMostLikely) {
  int maxValueIndex = pdfPerCluster.maxValueIndex();
  WeightedPropertyVectorWritable weightedPropertyVectorWritable =
    new WeightedPropertyVectorWritable(pdfPerCluster.maxValue(), vw.get(), props);
  write(clusterModels, writer, weightedPropertyVectorWritable, maxValueIndex);
 } else {
  writeAllAboveThreshold(clusterModels, clusterClassificationThreshold, writer, vw, pdfPerCluster);
 }
}

代码示例来源:origin: org.apache.mahout/mahout-math

@Override
public double maxValue() {
 return delegate.maxValue();
}

代码示例来源:origin: org.apache.mahout/mahout-math

@Override
public double maxValue() {
 return delegate.maxValue();
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
 public double apply(Vector column) {
  return column.maxValue();
 }
}).maxValue();

代码示例来源:origin: cheng-li/pyramid

/**
 * always use global min and max
 * @param vector
 * @param inputsEachClass
 * @return
 */
public List<EmpiricalCDF> generateCDFs(Vector vector, List<List<Double>> inputsEachClass){
  double min = vector.minValue();
  double max = vector.maxValue();
  return inputsEachClass.stream().map(list -> new EmpiricalCDF(list,min,max,numBins)).collect(Collectors.toList());
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
 public double apply(Vector f) {
  // Return the sum of three discrepancy measures.
  return Math.abs(f.minValue()) + Math.abs(f.maxValue() - 6) + Math.abs(f.norm(1) - 6);
 }
});

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
public Vector classify(Vector instance) {
 Vector result = classifyNoLink(instance);
 // Convert to probabilities by exponentiation.
 double max = result.maxValue();
 result.assign(Functions.minus(max)).assign(Functions.EXP);
 result = result.divide(result.norm(1));
 return result.viewPart(1, result.size() - 1);
}

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
public Vector classify(Vector instance) {
 Vector result = classifyNoLink(instance);
 // Convert to probabilities by exponentiation.
 double max = result.maxValue();
 result.assign(Functions.minus(max)).assign(Functions.EXP);
 result = result.divide(result.norm(1));
 return result.viewPart(1, result.size() - 1);
}

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
public Vector classify(Vector instance) {
 Vector result = classifyNoLink(instance);
 // Convert to probabilities by exponentiation.
 double max = result.maxValue();
 result.assign(Functions.minus(max)).assign(Functions.EXP);
 result = result.divide(result.norm(1));
 return result.viewPart(1, result.size() - 1);
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Test
public void testAddToVectorUsesProductOfWeights() {
 WordValueEncoder wv = new StaticWordValueEncoder("word");
 ContinuousValueEncoder cv = new ContinuousValueEncoder("cont");
 InteractionValueEncoder enc = new InteractionValueEncoder("interactions", wv, cv);
 Vector v1 = new DenseVector(200);
 enc.addInteractionToVector("a","0.9",0.5, v1);
 int k = enc.getProbes();
 // should set k distinct locations to 0.9*0.5
 assertEquals((float) k*0.5*0.9, v1.norm(1), 0);
 assertEquals(0.5*0.9, v1.maxValue(), 0);
}

相关文章