/** * Creates a new shallow copy of a {@code WeightedValue}. * * @param other The {@code WeightedValue} to shallow copy. */ public DefaultWeightedValue( final WeightedValue<? extends ValueType> other) { this(other.getValue(), other.getWeight()); }
/** * Creates a new {@code DefaultWeightedValueDiscriminant} whose weight * and value are taken from the given weighted value. * * @param other * The other weighted value to make a shallow copy of. */ public DefaultWeightedValueDiscriminant( final WeightedValue<? extends ValueType> other) { this(other.getValue(), other.getWeight()); }
/** * Creates a new shallow copy of a {@code WeightedValue}. * * @param other The {@code WeightedValue} to shallow copy. */ public DefaultWeightedValue( final WeightedValue<? extends ValueType> other) { this(other.getValue(), other.getWeight()); }
/** * Creates a new shallow copy of a {@code WeightedValue}. * * @param other The {@code WeightedValue} to shallow copy. */ public DefaultWeightedValue( final WeightedValue<? extends ValueType> other) { this(other.getValue(), other.getWeight()); }
/** * Creates a new {@code DefaultWeightedValueDiscriminant} whose weight * and value are taken from the given weighted value. * * @param other * The other weighted value to make a shallow copy of. */ public DefaultWeightedValueDiscriminant( final WeightedValue<? extends ValueType> other) { this(other.getValue(), other.getWeight()); }
/** * Creates a new {@code DefaultWeightedValueDiscriminant} whose weight * and value are taken from the given weighted value. * * @param other * The other weighted value to make a shallow copy of. */ public DefaultWeightedValueDiscriminant( final WeightedValue<? extends ValueType> other) { this(other.getValue(), other.getWeight()); }
@Override public void update( final DefaultDataDistribution.PMF<KeyType> target, final WeightedValue<? extends KeyType> data) { target.increment( data.getValue(), data.getWeight() ); }
@Override public void update( final DefaultDataDistribution.PMF<KeyType> target, final WeightedValue<? extends KeyType> data) { target.increment( data.getValue(), data.getWeight() ); }
@Override public void update( final DefaultDataDistribution.PMF<KeyType> target, final WeightedValue<? extends KeyType> data) { target.increment( data.getValue(), data.getWeight() ); }
public <SampleType> UnivariateGaussian.PDF integrate( List<? extends WeightedValue<? extends SampleType>> samples, Evaluator<? super SampleType, ? extends Double> expectationFunction) { ArrayList<DefaultWeightedValue<Double>> outputs = new ArrayList<DefaultWeightedValue<Double>>( samples.size() ); for( WeightedValue<? extends SampleType> sample : samples ) { Double output = expectationFunction.evaluate(sample.getValue()); outputs.add( new DefaultWeightedValue<Double>(output, sample.getWeight()) ); } return this.getMean(outputs); }
public <SampleType> UnivariateGaussian.PDF integrate( List<? extends WeightedValue<? extends SampleType>> samples, Evaluator<? super SampleType, ? extends Double> expectationFunction) { ArrayList<DefaultWeightedValue<Double>> outputs = new ArrayList<DefaultWeightedValue<Double>>( samples.size() ); for( WeightedValue<? extends SampleType> sample : samples ) { Double output = expectationFunction.evaluate(sample.getValue()); outputs.add( new DefaultWeightedValue<Double>(output, sample.getWeight()) ); } return this.getMean(outputs); }
public <SampleType> UnivariateGaussian.PDF integrate( List<? extends WeightedValue<? extends SampleType>> samples, Evaluator<? super SampleType, ? extends Double> expectationFunction) { ArrayList<DefaultWeightedValue<Double>> outputs = new ArrayList<DefaultWeightedValue<Double>>( samples.size() ); for( WeightedValue<? extends SampleType> sample : samples ) { Double output = expectationFunction.evaluate(sample.getValue()); outputs.add( new DefaultWeightedValue<Double>(output, sample.getWeight()) ); } return this.getMean(outputs); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with a shallow copy of the given * the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param other * The other value to make a shallow copy of. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final WeightedValue<? extends ValueType> other) { return new DefaultWeightedValueDiscriminant<ValueType>( other.getValue(), other.getWeight()); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with a shallow copy of the given * the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param other * The other value to make a shallow copy of. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final WeightedValue<? extends ValueType> other) { return new DefaultWeightedValueDiscriminant<ValueType>( other.getValue(), other.getWeight()); }
public <SampleType> MultivariateGaussian.PDF integrate( List<? extends WeightedValue<? extends SampleType>> samples, Evaluator<? super SampleType, ? extends Vector> expectationFunction) { ArrayList<DefaultWeightedValue<Vector>> outputs = new ArrayList<DefaultWeightedValue<Vector>>( samples.size() ); for( WeightedValue<? extends SampleType> sample : samples ) { Vector output = expectationFunction.evaluate(sample.getValue()).convertToVector(); outputs.add( new DefaultWeightedValue<Vector>(output, sample.getWeight()) ); } return MultivariateGaussian.WeightedMaximumLikelihoodEstimator.learn( outputs, DEFAULT_VARIANCE); }
public <SampleType> MultivariateGaussian.PDF integrate( List<? extends WeightedValue<? extends SampleType>> samples, Evaluator<? super SampleType, ? extends Vector> expectationFunction) { ArrayList<DefaultWeightedValue<Vector>> outputs = new ArrayList<DefaultWeightedValue<Vector>>( samples.size() ); for( WeightedValue<? extends SampleType> sample : samples ) { Vector output = expectationFunction.evaluate(sample.getValue()).convertToVector(); outputs.add( new DefaultWeightedValue<Vector>(output, sample.getWeight()) ); } return MultivariateGaussian.WeightedMaximumLikelihoodEstimator.learn( outputs, DEFAULT_VARIANCE); }
public <SampleType> MultivariateGaussian.PDF integrate( List<? extends WeightedValue<? extends SampleType>> samples, Evaluator<? super SampleType, ? extends Vector> expectationFunction) { ArrayList<DefaultWeightedValue<Vector>> outputs = new ArrayList<DefaultWeightedValue<Vector>>( samples.size() ); for( WeightedValue<? extends SampleType> sample : samples ) { Vector output = expectationFunction.evaluate(sample.getValue()).convertToVector(); outputs.add( new DefaultWeightedValue<Vector>(output, sample.getWeight()) ); } return MultivariateGaussian.WeightedMaximumLikelihoodEstimator.learn( outputs, DEFAULT_VARIANCE); }
public RingType summarize( Collection<? extends WeightedValue<RingType>> data) { double weightSum = 0.0; RingAccumulator<RingType> weightedSum = new RingAccumulator<RingType>(); for( WeightedValue<RingType> value : data ) { final double w = value.getWeight(); weightSum += w; weightedSum.accumulate( value.getValue().scale( w ) ); } return weightedSum.getSum().scale( 1.0/weightSum ); }
public RingType summarize( Collection<? extends WeightedValue<RingType>> data) { double weightSum = 0.0; RingAccumulator<RingType> weightedSum = new RingAccumulator<RingType>(); for( WeightedValue<RingType> value : data ) { final double w = value.getWeight(); weightSum += w; weightedSum.accumulate( value.getValue().scale( w ) ); } return weightedSum.getSum().scale( 1.0/weightSum ); }
public RingType summarize( Collection<? extends WeightedValue<RingType>> data) { double weightSum = 0.0; RingAccumulator<RingType> weightedSum = new RingAccumulator<RingType>(); for( WeightedValue<RingType> value : data ) { final double w = value.getWeight(); weightSum += w; weightedSum.accumulate( value.getValue().scale( w ) ); } return weightedSum.getSum().scale( 1.0/weightSum ); }