Skip to content

Commit e4ca1e1

Browse files
committed
Moved Neighborhood into algo package for public visibility
1 parent 0bdec4c commit e4ca1e1

31 files changed

+337
-87
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A Java-based set of __classification__ clustering algorithms. Built under JDK 1.
99

1010
___
1111
### Installation:
12-
__Clust4j 1.0.0 prerelease is now available under [releases](https://github.com/tgsmith61591/clust4j/releases) (jar included)__. To build the bleeding edge, use the included gradle wrapper:
12+
__Clust4j 1.1.6 prerelease is now available under [releases](https://github.com/tgsmith61591/clust4j/releases). To build the bleeding edge, use the included gradle wrapper:
1313

1414
```bash
1515
git clone https://github.com/tgsmith61591/clust4j.git

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'jacoco'
55
sourceCompatibility = 1.7
66
targetCompatibility = 1.7
77
archivesBaseName = 'clust4j'
8-
version = '1.1.5-SNAPSHOT'
8+
version = '1.1.6-SNAPSHOT'
99

1010

1111

src/main/java/com/clust4j/algo/AbstractClusterer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*******************************************************************************/
16+
1617
package com.clust4j.algo;
1718

1819
import java.text.NumberFormat;
@@ -124,7 +125,7 @@ protected AbstractClusterer(AbstractClusterer caller) {
124125
* @param planner
125126
*/
126127
protected AbstractClusterer(AbstractClusterer caller, BaseClustererParameters planner) {
127-
this.dist_metric= null == planner ? caller.dist_metric : planner.getSep();
128+
this.dist_metric= null == planner ? caller.dist_metric : planner.getMetric();
128129
this.verbose = null == planner ? false : planner.getVerbose(); // if another caller, default to false
129130
this.modelKey = UUID.randomUUID();
130131
this.random_state = null == planner ? caller.random_state : planner.getSeed();
@@ -138,7 +139,7 @@ protected AbstractClusterer(AbstractClusterer caller, BaseClustererParameters pl
138139

139140
protected AbstractClusterer(AbstractRealMatrix data, BaseClustererParameters planner, boolean as_is) {
140141

141-
this.dist_metric = planner.getSep();
142+
this.dist_metric = planner.getMetric();
142143
this.verbose = planner.getVerbose();
143144
this.modelKey = UUID.randomUUID();
144145
this.random_state = planner.getSeed();

src/main/java/com/clust4j/algo/AbstractDBSCAN.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ abstract public static class AbstractDBSCANPlanner<T extends AbstractDBSCAN>
4343
extends BaseClustererParameters
4444
implements UnsupervisedClassifierParameters<T> {
4545
private static final long serialVersionUID = 765572960123009344L;
46+
protected int minPts = DEF_MIN_PTS;
4647

4748
abstract public AbstractDBSCANPlanner<T> setMinPts(final int minPts);
48-
abstract public int getMinPts();
49+
final public int getMinPts() {
50+
return minPts;
51+
}
4952
}
5053

5154
public int getMinPts() {

src/main/java/com/clust4j/algo/AffinityPropagationParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;

src/main/java/com/clust4j/algo/BaseClustererParameters.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;
@@ -36,7 +52,7 @@ abstract public class BaseClustererParameters
3652
abstract public BaseClustererParameters setForceParallel(final boolean b);
3753

3854
final public FeatureNormalization getNormalizer() { return norm; }
39-
final public GeometricallySeparable getSep() { return metric; }
55+
final public GeometricallySeparable getMetric() { return metric; }
4056
final public boolean getParallel() { return parallel; }
4157
final public boolean getScale() { return scale; }
4258
final public Random getSeed() { return seed; }

src/main/java/com/clust4j/algo/BaseNeighborsModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.apache.commons.math3.linear.AbstractRealMatrix;
1919

2020
import com.clust4j.GlobalState;
21-
import com.clust4j.algo.NearestNeighborHeapSearch.Neighborhood;
21+
import com.clust4j.algo.Neighborhood;
2222
import com.clust4j.except.ModelNotFitException;
2323
import com.clust4j.metrics.pairwise.DistanceMetric;
2424
import com.clust4j.metrics.pairwise.GeometricallySeparable;

src/main/java/com/clust4j/algo/BoruvkaAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.apache.commons.math3.linear.Array2DRowRealMatrix;
1919
import org.apache.commons.math3.util.FastMath;
2020

21-
import com.clust4j.algo.NearestNeighborHeapSearch.Neighborhood;
21+
import com.clust4j.algo.Neighborhood;
2222
import com.clust4j.algo.NearestNeighborHeapSearch.NodeData;
2323
import com.clust4j.log.LogTimer;
2424
import com.clust4j.log.Loggable;

src/main/java/com/clust4j/algo/CentroidClustererParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import org.apache.commons.math3.linear.AbstractRealMatrix;

src/main/java/com/clust4j/algo/DBSCANParameters.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;
@@ -17,7 +33,6 @@ final public class DBSCANParameters extends AbstractDBSCANPlanner<DBSCAN> {
1733
private static final long serialVersionUID = -5285244186285768512L;
1834

1935
private double eps = DBSCAN.DEF_EPS;
20-
private int minPts = DBSCAN.DEF_MIN_PTS;
2136

2237

2338
public DBSCANParameters() { }
@@ -46,11 +61,6 @@ public DBSCANParameters copy() {
4661
public double getEps() {
4762
return eps;
4863
}
49-
50-
@Override
51-
public int getMinPts() {
52-
return minPts;
53-
}
5464

5565
public DBSCANParameters setEps(final double eps) {
5666
this.eps = eps;

src/main/java/com/clust4j/algo/HDBSCAN.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import com.clust4j.GlobalState;
3333
import com.clust4j.utils.QuadTup;
34-
import com.clust4j.algo.NearestNeighborHeapSearch.Neighborhood;
34+
import com.clust4j.algo.Neighborhood;
3535
import com.clust4j.except.ModelNotFitException;
3636
import com.clust4j.log.LogTimer;
3737
import com.clust4j.log.Loggable;

src/main/java/com/clust4j/algo/HDBSCANParameters.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;
@@ -17,7 +33,6 @@
1733
final public class HDBSCANParameters extends AbstractDBSCANPlanner<HDBSCAN> {
1834
private static final long serialVersionUID = 7197585563308908685L;
1935

20-
private int minPts = HDBSCAN.DEF_MIN_PTS;
2136
private HDBSCAN_Algorithm algo = HDBSCAN.DEF_ALGO;
2237
private double alpha = HDBSCAN.DEF_ALPHA;
2338
private boolean approxMinSpanTree = HDBSCAN.DEF_APPROX_MIN_SPAN;
@@ -52,11 +67,6 @@ public HDBSCANParameters copy() {
5267
.setNormalizer(norm)
5368
.setForceParallel(parallel);
5469
}
55-
56-
@Override
57-
public int getMinPts() {
58-
return minPts;
59-
}
6070

6171
public HDBSCAN_Algorithm getAlgo() {
6272
return this.algo;

src/main/java/com/clust4j/algo/HierarchicalAgglomerativeParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;

src/main/java/com/clust4j/algo/KMeansParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;

src/main/java/com/clust4j/algo/KMedoidsParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;

src/main/java/com/clust4j/algo/MeanShift.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.apache.commons.math3.util.FastMath;
3131

3232
import com.clust4j.algo.NearestNeighborsParameters;
33-
import com.clust4j.algo.NearestNeighborHeapSearch.Neighborhood;
33+
import com.clust4j.algo.Neighborhood;
3434
import com.clust4j.algo.RadiusNeighborsParameters;
3535
import com.clust4j.except.IllegalClusterStateException;
3636
import com.clust4j.except.ModelNotFitException;

src/main/java/com/clust4j/algo/MeanShiftParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;

src/main/java/com/clust4j/algo/NearestCentroidParameters.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*******************************************************************************
2+
* Copyright 2015, 2016 Taylor G Smith
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
117
package com.clust4j.algo;
218

319
import java.util.Random;

0 commit comments

Comments
 (0)