/** * Replace data with a fresh copy of the input array. * * @param in Data to copy. * @throws NoDataException if the input array is empty. * @throws DimensionMismatchException if the input array is not rectangular. * @throws NullArgumentException if the input array is {@code null}. */ private void copyIn(final double[][] in) throws DimensionMismatchException, NoDataException, NullArgumentException { setSubMatrix(in, 0, 0); } }
public void mergeWith(SpeakerCluster target) throws NullPointerException { if (target == null) throw new NullPointerException(); Iterator<Segment> it = target.segmentSet.iterator(); while (it.hasNext()) { if (!this.addSegment(it.next())) System.out.println("Something doesn't work in mergeWith method, Cluster class"); } int rowDim = featureMatrix.getRowDimension() + target.getFeatureMatrix().getRowDimension(); int colDim = featureMatrix.getColumnDimension(); Array2DRowRealMatrix combinedFeatures = new Array2DRowRealMatrix(rowDim, colDim); combinedFeatures.setSubMatrix(featureMatrix.getData(), 0, 0); combinedFeatures .setSubMatrix(target.getFeatureMatrix().getData(), featureMatrix.getRowDimension(), 0); bicValue = SpeakerIdentification.getBICValue(combinedFeatures); featureMatrix = new Array2DRowRealMatrix(combinedFeatures.getData()); } }
double computeDistance(SpeakerCluster c1, SpeakerCluster c2) { int rowDim = c1.getFeatureMatrix().getRowDimension() + c2.getFeatureMatrix().getRowDimension(); int colDim = c1.getFeatureMatrix().getColumnDimension(); Array2DRowRealMatrix combinedFeatures = new Array2DRowRealMatrix(rowDim, colDim); combinedFeatures.setSubMatrix(c1.getFeatureMatrix().getData(), 0, 0); combinedFeatures.setSubMatrix(c2.getFeatureMatrix().getData(), c1.getFeatureMatrix() .getRowDimension(), 0); double bicValue = getBICValue(combinedFeatures); double d = Segment.FEATURES_SIZE; double penalty = 0.5 * (d + 0.5 * d * (d + 1)) * Math.log(combinedFeatures.getRowDimension()) * 2; return bicValue - c1.getBicValue() - c2.getBicValue() - penalty; }
/** * Replace data with a fresh copy of the input array. * * @param in Data to copy. * @throws NoDataException if the input array is empty. * @throws DimensionMismatchException if the input array is not rectangular. * @throws NullArgumentException if the input array is {@code null}. */ private void copyIn(final double[][] in) throws DimensionMismatchException, NoDataException, NullArgumentException { setSubMatrix(in, 0, 0); } }
/** * Replace data with a fresh copy of the input array. * * @param in Data to copy. * @throws NoDataException if the input array is empty. * @throws DimensionMismatchException if the input array is not rectangular. * @throws NullArgumentException if the input array is {@code null}. */ private void copyIn(final double[][] in) throws DimensionMismatchException, NoDataException, NullArgumentException { setSubMatrix(in, 0, 0); } }
public void mergeWith(SpeakerCluster target) throws NullPointerException { if (target == null) throw new NullPointerException(); Iterator<Segment> it = target.segmentSet.iterator(); while (it.hasNext()) { if (!this.addSegment(it.next())) System.out.println("Something doesn't work in mergeWith method, Cluster class"); } int rowDim = featureMatrix.getRowDimension() + target.getFeatureMatrix().getRowDimension(); int colDim = featureMatrix.getColumnDimension(); Array2DRowRealMatrix combinedFeatures = new Array2DRowRealMatrix(rowDim, colDim); combinedFeatures.setSubMatrix(featureMatrix.getData(), 0, 0); combinedFeatures .setSubMatrix(target.getFeatureMatrix().getData(), featureMatrix.getRowDimension(), 0); bicValue = SpeakerIdentification.getBICValue(combinedFeatures); featureMatrix = new Array2DRowRealMatrix(combinedFeatures.getData()); } }
double computeDistance(SpeakerCluster c1, SpeakerCluster c2) { int rowDim = c1.getFeatureMatrix().getRowDimension() + c2.getFeatureMatrix().getRowDimension(); int colDim = c1.getFeatureMatrix().getColumnDimension(); Array2DRowRealMatrix combinedFeatures = new Array2DRowRealMatrix(rowDim, colDim); combinedFeatures.setSubMatrix(c1.getFeatureMatrix().getData(), 0, 0); combinedFeatures.setSubMatrix(c2.getFeatureMatrix().getData(), c1.getFeatureMatrix() .getRowDimension(), 0); double bicValue = getBICValue(combinedFeatures); double d = Segment.FEATURES_SIZE; double penalty = 0.5 * (d + 0.5 * d * (d + 1)) * Math.log(combinedFeatures.getRowDimension()) * 2; return bicValue - c1.getBicValue() - c2.getBicValue() - penalty; }
{ evEval / 2, eEval, fEval }, { guEval / 2, fEval, gEval } }; matrix1.setSubMatrix(m1, 0, 0); matrix2.setSubMatrix(m2, 0, 0);