@Override public double minValue() { return delegate.minValue(); }
@Override public double minValue() { return delegate.minValue(); }
@Override public double minValue() { return delegate.minValue(); }
@Override public double minValue() { return delegate.minValue(); }
@Override public double minValue() { return delegate.minValue(); }
vec1.setQuick(2, 2); double max = vec1.minValue(); assertEquals(1.0, max, 0.0);
@Override public double apply(Vector column) { return column.minValue(); } }).minValue();
/** * 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()); }
public void validate() { Preconditions.checkState(alphaI > 0, "alphaI has to be greater than 0!"); Preconditions.checkArgument(numFeatures > 0, "the vocab count has to be greater than 0!"); Preconditions.checkArgument(totalWeightSum > 0, "the totalWeightSum has to be greater than 0!"); Preconditions.checkNotNull(weightsPerLabel, "the number of labels has to be defined!"); Preconditions.checkArgument(weightsPerLabel.getNumNondefaultElements() > 0, "the number of labels has to be greater than 0!"); Preconditions.checkNotNull(weightsPerFeature, "the feature sums have to be defined"); Preconditions.checkArgument(weightsPerFeature.getNumNondefaultElements() > 0, "the feature sums have to be greater than 0!"); if (isComplementary){ Preconditions.checkArgument(perlabelThetaNormalizer != null, "the theta normalizers have to be defined"); Preconditions.checkArgument(perlabelThetaNormalizer.getNumNondefaultElements() > 0, "the number of theta normalizers has to be greater than 0!"); Preconditions.checkArgument(Math.signum(perlabelThetaNormalizer.minValue()) == Math.signum(perlabelThetaNormalizer.maxValue()), "Theta normalizers do not all have the same sign"); Preconditions.checkArgument(perlabelThetaNormalizer.getNumNonZeroElements() == perlabelThetaNormalizer.size(), "Theta normalizers can not have zero value."); } } }
public void validate() { Preconditions.checkState(alphaI > 0, "alphaI has to be greater than 0!"); Preconditions.checkArgument(numFeatures > 0, "the vocab count has to be greater than 0!"); Preconditions.checkArgument(totalWeightSum > 0, "the totalWeightSum has to be greater than 0!"); Preconditions.checkNotNull(weightsPerLabel, "the number of labels has to be defined!"); Preconditions.checkArgument(weightsPerLabel.getNumNondefaultElements() > 0, "the number of labels has to be greater than 0!"); Preconditions.checkNotNull(weightsPerFeature, "the feature sums have to be defined"); Preconditions.checkArgument(weightsPerFeature.getNumNondefaultElements() > 0, "the feature sums have to be greater than 0!"); if (isComplementary){ Preconditions.checkArgument(perlabelThetaNormalizer != null, "the theta normalizers have to be defined"); Preconditions.checkArgument(perlabelThetaNormalizer.getNumNondefaultElements() > 0, "the number of theta normalizers has to be greater than 0!"); Preconditions.checkArgument(Math.signum(perlabelThetaNormalizer.minValue()) == Math.signum(perlabelThetaNormalizer.maxValue()), "Theta normalizers do not all have the same sign"); Preconditions.checkArgument(perlabelThetaNormalizer.getNumNonZeroElements() == perlabelThetaNormalizer.size(), "Theta normalizers can not have zero value."); } } }
@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); } });
if (samples.minValue() >= 1) {
if (samples.minValue() >= 1) {
if (samples.minValue() >= 1) {
private void normalize(Matrix source, final double range) { final double max = source.aggregateColumns(new VectorFunction() { @Override public double apply(Vector column) { return column.maxValue(); } }).maxValue(); final double min = source.aggregateColumns(new VectorFunction() { @Override public double apply(Vector column) { return column.minValue(); } }).minValue(); source.assign(new DoubleFunction() { @Override public double apply(double value) { return (value - min) * range / (max - min); } }); }
Vector v1 = new DenseVector(20); enc.addToVector((byte[]) null, -123, v1); assertEquals(-123, v1.minValue(), 0); assertEquals(0, v1.maxValue(), 0); assertEquals(123, v1.norm(1), 0); enc.addToVector((byte[]) null, 123, v1); assertEquals(123, v1.maxValue(), 0); assertEquals(0, v1.minValue(), 0); assertEquals(123, v1.norm(1), 0);
Vector v1 = new DenseVector(20); enc.addToVector("-123", v1); assertEquals(-123, v1.minValue(), 0); assertEquals(0, v1.maxValue(), 0); assertEquals(123, v1.norm(1), 0); enc.addToVector("123", v1); assertEquals(123, v1.maxValue(), 0); assertEquals(0, v1.minValue(), 0); assertEquals(123, v1.norm(1), 0);
vec1.setQuick(2, 2); double max = vec1.minValue(); assertEquals(1.0, max, 0.0);