Remove spurious "throws" clauses.

This commit is contained in:
Gilles 2020-03-10 23:22:11 +01:00
parent fb78e1af4f
commit aeca88c72d
4 changed files with 12 additions and 29 deletions

View File

@ -80,8 +80,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
* @param minPts minimum number of points needed for a cluster
* @throws NotPositiveException if {@code eps < 0.0} or {@code minPts < 0}
*/
public DBSCANClusterer(final double eps, final int minPts)
throws NotPositiveException {
public DBSCANClusterer(final double eps, final int minPts) {
this(eps, minPts, new EuclideanDistance());
}
@ -93,8 +92,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
* @param measure the distance measure to use
* @throws NotPositiveException if {@code eps < 0.0} or {@code minPts < 0}
*/
public DBSCANClusterer(final double eps, final int minPts, final DistanceMeasure measure)
throws NotPositiveException {
public DBSCANClusterer(final double eps, final int minPts, final DistanceMeasure measure) {
super(measure);
if (eps < 0.0d) {
@ -131,8 +129,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
* @throws NullArgumentException if the data points are null
*/
@Override
public List<Cluster<T>> cluster(final Collection<T> points) throws NullArgumentException {
public List<Cluster<T>> cluster(final Collection<T> points) {
// sanity checks
MathUtils.checkNotNull(points);

View File

@ -103,7 +103,7 @@ public class FuzzyKMeansClusterer<T extends Clusterable> extends Clusterer<T> {
* @param fuzziness the fuzziness factor, must be &gt; 1.0
* @throws NumberIsTooSmallException if {@code fuzziness <= 1.0}
*/
public FuzzyKMeansClusterer(final int k, final double fuzziness) throws NumberIsTooSmallException {
public FuzzyKMeansClusterer(final int k, final double fuzziness) {
this(k, fuzziness, -1, new EuclideanDistance());
}
@ -118,8 +118,7 @@ public class FuzzyKMeansClusterer<T extends Clusterable> extends Clusterer<T> {
* @throws NumberIsTooSmallException if {@code fuzziness <= 1.0}
*/
public FuzzyKMeansClusterer(final int k, final double fuzziness,
final int maxIterations, final DistanceMeasure measure)
throws NumberIsTooSmallException {
final int maxIterations, final DistanceMeasure measure) {
this(k, fuzziness, maxIterations, measure, DEFAULT_EPSILON, RandomSource.create(RandomSource.MT_64));
}
@ -137,9 +136,7 @@ public class FuzzyKMeansClusterer<T extends Clusterable> extends Clusterer<T> {
*/
public FuzzyKMeansClusterer(final int k, final double fuzziness,
final int maxIterations, final DistanceMeasure measure,
final double epsilon, final UniformRandomProvider random)
throws NumberIsTooSmallException {
final double epsilon, final UniformRandomProvider random) {
super(measure);
if (fuzziness <= 1.0d) {
@ -265,9 +262,7 @@ public class FuzzyKMeansClusterer<T extends Clusterable> extends Clusterer<T> {
* of clusters is larger than the number of data points
*/
@Override
public List<CentroidCluster<T>> cluster(final Collection<T> dataPoints)
throws MathIllegalArgumentException {
public List<CentroidCluster<T>> cluster(final Collection<T> dataPoints) {
// sanity checks
MathUtils.checkNotNull(dataPoints);

View File

@ -193,9 +193,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
* {@link #emptyStrategy} is set to {@code ERROR}
*/
@Override
public List<CentroidCluster<T>> cluster(final Collection<T> points)
throws MathIllegalArgumentException, ConvergenceException {
public List<CentroidCluster<T>> cluster(final Collection<T> points) {
// sanity checks
MathUtils.checkNotNull(points);
@ -410,9 +408,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
* @return a random point from the selected cluster
* @throws ConvergenceException if clusters are all empty
*/
private T getPointFromLargestVarianceCluster(final Collection<CentroidCluster<T>> clusters)
throws ConvergenceException {
private T getPointFromLargestVarianceCluster(final Collection<CentroidCluster<T>> clusters) {
double maxVariance = Double.NEGATIVE_INFINITY;
Cluster<T> selected = null;
for (final CentroidCluster<T> cluster : clusters) {
@ -453,9 +449,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
* @return a random point from the selected cluster
* @throws ConvergenceException if clusters are all empty
*/
private T getPointFromLargestNumberCluster(final Collection<? extends Cluster<T>> clusters)
throws ConvergenceException {
private T getPointFromLargestNumberCluster(final Collection<? extends Cluster<T>> clusters) {
int maxNumber = 0;
Cluster<T> selected = null;
for (final Cluster<T> cluster : clusters) {
@ -489,8 +483,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
* @return point farthest to its cluster center
* @throws ConvergenceException if clusters are all empty
*/
private T getFarthestPoint(final Collection<CentroidCluster<T>> clusters) throws ConvergenceException {
private T getFarthestPoint(final Collection<CentroidCluster<T>> clusters) {
double maxDistance = Double.NEGATIVE_INFINITY;
Cluster<T> selectedCluster = null;
int selectedPoint = -1;

View File

@ -79,9 +79,7 @@ public class MultiKMeansPlusPlusClusterer<T extends Clusterable> extends Cluster
* {@link KMeansPlusPlusClusterer.EmptyClusterStrategy} is set to {@code ERROR}.
*/
@Override
public List<CentroidCluster<T>> cluster(final Collection<T> points)
throws MathIllegalArgumentException, ConvergenceException {
public List<CentroidCluster<T>> cluster(final Collection<T> points) {
// at first, we have not found any clusters list yet
List<CentroidCluster<T>> best = null;
double bestRank = Double.NEGATIVE_INFINITY;