/** * Computes the minimum and maximum of a set of data in a single pass. * @param data * Data to consider * @return * Minimum and Maximum */ public static Pair<Double,Double> computeMinAndMax( Iterable<? extends Number> data ) { double min = Double.POSITIVE_INFINITY; double max = Double.NEGATIVE_INFINITY; for( Number value : data ) { double x = value.doubleValue(); if( min > x ) { min = x; } if( max < x ) { max = x; } } return DefaultPair.create( min, max ); }
/** * Computes the minimum and maximum of a set of data in a single pass. * @param data * Data to consider * @return * Minimum and Maximum */ public static Pair<Double,Double> computeMinAndMax( Iterable<? extends Number> data ) { double min = Double.POSITIVE_INFINITY; double max = Double.NEGATIVE_INFINITY; for( Number value : data ) { double x = value.doubleValue(); if( min > x ) { min = x; } if( max < x ) { max = x; } } return DefaultPair.create( min, max ); }
/** * Computes the minimum and maximum of a set of data in a single pass. * @param data * Data to consider * @return * Minimum and Maximum */ public static Pair<Double,Double> computeMinAndMax( Iterable<? extends Number> data ) { double min = Double.POSITIVE_INFINITY; double max = Double.NEGATIVE_INFINITY; for( Number value : data ) { double x = value.doubleValue(); if( min > x ) { min = x; } if( max < x ) { max = x; } } return DefaultPair.create( min, max ); }
return DefaultPair.create(mean, variance);
return DefaultPair.create(mean, variance);
return DefaultPair.create( this.creator.createCluster(leftMembers), this.creator.createCluster(rightMembers));
return DefaultPair.create( dtrue, dfalse );
return DefaultPair.create( dtrue, dfalse );
return DefaultPair.create( dtrue, dfalse );
public DefaultPair<FiniteCapacityBuffer<Double>, FiniteCapacityBuffer<Double>> createDefaultState() { return DefaultPair.create( new FiniteCapacityBuffer<Double>( this.getNumMovingAverageCoefficients() ), new FiniteCapacityBuffer<Double>( this.getNumAutoRegressiveCoefficients() ) ); }
public DefaultPair<FiniteCapacityBuffer<Double>, FiniteCapacityBuffer<Double>> createDefaultState() { return DefaultPair.create( new FiniteCapacityBuffer<Double>( this.getNumMovingAverageCoefficients() ), new FiniteCapacityBuffer<Double>( this.getNumAutoRegressiveCoefficients() ) ); }
public DefaultPair<FiniteCapacityBuffer<Double>, FiniteCapacityBuffer<Double>> createDefaultState() { return DefaultPair.create( new FiniteCapacityBuffer<Double>( this.getNumMovingAverageCoefficients() ), new FiniteCapacityBuffer<Double>( this.getNumAutoRegressiveCoefficients() ) ); }
nextDelta.scaleEquals( 1.0/nextDelta.norm1() ); return DefaultPair.create( nextDelta, psis );
nextDelta.scaleEquals( 1.0/nextDelta.norm1() ); return DefaultPair.create( nextDelta, psis );
return DefaultPair.create( allGammas, sequenceTransitionMatrices );
return DefaultPair.create( allGammas, sequenceTransitionMatrices );
return DefaultPair.create( allGammas, sequenceTransitionMatrices );
/** * Computes the Viterbi recursion for a given "delta" and "b" * @param delta * Previous value of the Viterbi recursion. * @param bn * Current observation likelihood. * @return * Updated "delta" and state backpointers. */ protected Pair<Vector,int[]> computeViterbiRecursion( Vector delta, Vector bn ) { final int k = delta.getDimensionality(); final Vector dn = VectorFactory.getDefault().createVector(k); final int[] psi = new int[ k ]; for( int i = 0; i < k; i++ ) { WeightedValue<Integer> transition = this.findMostLikelyState(i, delta); psi[i] = transition.getValue(); dn.setElement(i, transition.getWeight()); } dn.dotTimesEquals( bn ); delta = dn; delta.scaleEquals( 1.0/delta.norm1() ); return DefaultPair.create( delta, psi ); }
/** * Computes the Viterbi recursion for a given "delta" and "b" * @param delta * Previous value of the Viterbi recursion. * @param bn * Current observation likelihood. * @return * Updated "delta" and state backpointers. */ protected Pair<Vector,int[]> computeViterbiRecursion( Vector delta, Vector bn ) { final int k = delta.getDimensionality(); final Vector dn = VectorFactory.getDefault().createVector(k); final int[] psi = new int[ k ]; for( int i = 0; i < k; i++ ) { WeightedValue<Integer> transition = this.findMostLikelyState(i, delta); psi[i] = transition.getValue(); dn.setElement(i, transition.getWeight()); } dn.dotTimesEquals( bn ); delta = dn; delta.scaleEquals( 1.0/delta.norm1() ); return DefaultPair.create( delta, psi ); }
/** * Computes the Viterbi recursion for a given "delta" and "b" * @param delta * Previous value of the Viterbi recursion. * @param bn * Current observation likelihood. * @return * Updated "delta" and state backpointers. */ protected Pair<Vector,int[]> computeViterbiRecursion( Vector delta, Vector bn ) { final int k = delta.getDimensionality(); final Vector dn = VectorFactory.getDefault().createVector(k); final int[] psi = new int[ k ]; for( int i = 0; i < k; i++ ) { WeightedValue<Integer> transition = this.findMostLikelyState(i, delta); psi[i] = transition.getValue(); dn.setElement(i, transition.getWeight()); } dn.dotTimesEquals( bn ); delta = dn; delta.scaleEquals( 1.0/delta.norm1() ); return DefaultPair.create( delta, psi ); }