You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2020/03/13 03:10:29 UTC
[commons-math] branch master updated (169062c -> aef8f52)
This is an automated email from the ASF dual-hosted git repository.
erans pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git.
from 169062c Merge branch 'MATH-1524__ChenTao'
new cd0988f Method "centroid()" is available for any "Cluster" instance (userguide).
new aef8f52 Reduce visibility of method that is meant to be used internally only.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../commons/math4/ml/clustering/CentroidCluster.java | 2 +-
.../math4/userguide/ClusterAlgorithmComparison.java | 15 ++++++---------
2 files changed, 7 insertions(+), 10 deletions(-)
[commons-math] 01/02: Method "centroid()" is available for any
"Cluster" instance (userguide).
Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit cd0988f9bf85e301e168b9a0959ed5d91620c32d
Author: Gilles <gi...@gmail.com>
AuthorDate: Fri Mar 13 03:38:54 2020 +0100
Method "centroid()" is available for any "Cluster" instance (userguide).
See MATH-1524.
---
.../math4/userguide/ClusterAlgorithmComparison.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java b/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
index bb05047..2c631f0 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
@@ -41,7 +41,6 @@ import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
import org.apache.commons.statistics.distribution.NormalDistribution;
import org.apache.commons.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.ml.clustering.CentroidCluster;
import org.apache.commons.math4.ml.clustering.Cluster;
import org.apache.commons.math4.ml.clustering.Clusterable;
import org.apache.commons.math4.ml.clustering.Clusterer;
@@ -292,14 +291,12 @@ public class ClusterAlgorithmComparison {
g2.fill(new Ellipse2D.Double(arr[0] - 1, arr[1] - 1, 3, 3));
}
- if (cluster instanceof CentroidCluster) {
- Clusterable p = transform(((CentroidCluster<?>) cluster).getCenter(), w, h);
- double[] arr = p.getPoint();
- Shape s = new Ellipse2D.Double(arr[0] - 4, arr[1] - 4, 8, 8);
- g2.fill(s);
- g2.setPaint(Color.black);
- g2.draw(s);
- }
+ Clusterable p = transform(cluster.centroid(), w, h);
+ double[] arr = p.getPoint();
+ Shape s = new Ellipse2D.Double(arr[0] - 4, arr[1] - 4, 8, 8);
+ g2.fill(s);
+ g2.setPaint(Color.black);
+ g2.draw(s);
}
g2.setPaint(Color.black);
[commons-math] 02/02: Reduce visibility of method that is meant to
be used internally only.
Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit aef8f5272d9b3b6c15507232908e1be381ba49f1
Author: Gilles <gi...@gmail.com>
AuthorDate: Fri Mar 13 04:01:27 2020 +0100
Reduce visibility of method that is meant to be used internally only.
Note: Since "Cluster" is mutable, the "center" stored in "CentroidCluster"
may become inconsistent with the actual contents of the cluster.
See MATH-1524.
---
.../java/org/apache/commons/math4/ml/clustering/CentroidCluster.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java b/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
index ba08e23..a9ec074 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
@@ -46,7 +46,7 @@ public class CentroidCluster<T extends Clusterable> extends Cluster<T> {
* Get the point chosen to be the center of this cluster.
* @return chosen cluster center
*/
- public Clusterable getCenter() {
+ Clusterable getCenter() {
return center;
}