You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Erik van Ingen (JIRA)" <ji...@apache.org> on 2009/10/22 08:35:59 UTC
[jira] Created: (MATH-305) NPE in KMeansPlusPlusClusterer unittest
NPE in KMeansPlusPlusClusterer unittest
----------------------------------------
Key: MATH-305
URL: https://issues.apache.org/jira/browse/MATH-305
Project: Commons Math
Issue Type: Bug
Affects Versions: Nightly Builds
Environment: java 6, eclipse, apache commons math trunk
Reporter: Erik van Ingen
Fix For: Nightly Builds
When running this unittest, I am facing this NPE:
java.lang.NullPointerException
at org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer.assignPointsToClusters(KMeansPlusPlusClusterer.java:91)
This is the unittest:
package org.fao.fisheries.chronicles.calcuation.cluster;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import org.apache.commons.math.stat.clustering.Cluster;
import org.apache.commons.math.stat.clustering.EuclideanIntegerPoint;
import org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer;
import org.fao.fisheries.chronicles.input.CsvImportProcess;
import org.fao.fisheries.chronicles.input.Top200Csv;
import org.junit.Test;
public class ClusterAnalysisTest {
@Test
public void testPerformClusterAnalysis2() {
KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
new Random(1746432956321l));
EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
new EuclideanIntegerPoint(new int[] { 1959, 325100 }),
new EuclideanIntegerPoint(new int[] { 1960, 373200 }), };
List<Cluster<EuclideanIntegerPoint>> clusters = transformer.cluster(Arrays.asList(points), 1, 1);
assertEquals(1, clusters.size());
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (MATH-305) NPE in KMeansPlusPlusClusterer unittest
Posted by "Erik van Ingen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Erik van Ingen closed MATH-305.
-------------------------------
I have tested the fix and I can confirm that it is working in my environment. Thanks a lot!
> NPE in KMeansPlusPlusClusterer unittest
> ----------------------------------------
>
> Key: MATH-305
> URL: https://issues.apache.org/jira/browse/MATH-305
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: java 6, eclipse, apache commons math trunk
> Reporter: Erik van Ingen
> Fix For: 2.1
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> When running this unittest, I am facing this NPE:
> java.lang.NullPointerException
> at org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer.assignPointsToClusters(KMeansPlusPlusClusterer.java:91)
> This is the unittest:
> package org.fao.fisheries.chronicles.calcuation.cluster;
> import static org.junit.Assert.assertEquals;
> import static org.junit.Assert.assertTrue;
> import java.util.Arrays;
> import java.util.List;
> import java.util.Random;
> import org.apache.commons.math.stat.clustering.Cluster;
> import org.apache.commons.math.stat.clustering.EuclideanIntegerPoint;
> import org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer;
> import org.fao.fisheries.chronicles.input.CsvImportProcess;
> import org.fao.fisheries.chronicles.input.Top200Csv;
> import org.junit.Test;
> public class ClusterAnalysisTest {
> @Test
> public void testPerformClusterAnalysis2() {
> KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
> new Random(1746432956321l));
> EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
> new EuclideanIntegerPoint(new int[] { 1959, 325100 }),
> new EuclideanIntegerPoint(new int[] { 1960, 373200 }), };
> List<Cluster<EuclideanIntegerPoint>> clusters = transformer.cluster(Arrays.asList(points), 1, 1);
> assertEquals(1, clusters.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MATH-305) NPE in KMeansPlusPlusClusterer
unittest
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz resolved MATH-305.
------------------------------
Resolution: Fixed
The problem was due to overflow in MathUtils.distance() due to bad typing. Fixed in r885027.
> NPE in KMeansPlusPlusClusterer unittest
> ----------------------------------------
>
> Key: MATH-305
> URL: https://issues.apache.org/jira/browse/MATH-305
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: java 6, eclipse, apache commons math trunk
> Reporter: Erik van Ingen
> Fix For: 2.1
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> When running this unittest, I am facing this NPE:
> java.lang.NullPointerException
> at org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer.assignPointsToClusters(KMeansPlusPlusClusterer.java:91)
> This is the unittest:
> package org.fao.fisheries.chronicles.calcuation.cluster;
> import static org.junit.Assert.assertEquals;
> import static org.junit.Assert.assertTrue;
> import java.util.Arrays;
> import java.util.List;
> import java.util.Random;
> import org.apache.commons.math.stat.clustering.Cluster;
> import org.apache.commons.math.stat.clustering.EuclideanIntegerPoint;
> import org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer;
> import org.fao.fisheries.chronicles.input.CsvImportProcess;
> import org.fao.fisheries.chronicles.input.Top200Csv;
> import org.junit.Test;
> public class ClusterAnalysisTest {
> @Test
> public void testPerformClusterAnalysis2() {
> KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
> new Random(1746432956321l));
> EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
> new EuclideanIntegerPoint(new int[] { 1959, 325100 }),
> new EuclideanIntegerPoint(new int[] { 1960, 373200 }), };
> List<Cluster<EuclideanIntegerPoint>> clusters = transformer.cluster(Arrays.asList(points), 1, 1);
> assertEquals(1, clusters.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MATH-305) NPE in KMeansPlusPlusClusterer unittest
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz updated MATH-305:
-----------------------------
Affects Version/s: (was: Nightly Builds)
2.0
Fix Version/s: (was: Nightly Builds)
2.1
Thanks for reporting this.
> NPE in KMeansPlusPlusClusterer unittest
> ----------------------------------------
>
> Key: MATH-305
> URL: https://issues.apache.org/jira/browse/MATH-305
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: java 6, eclipse, apache commons math trunk
> Reporter: Erik van Ingen
> Fix For: 2.1
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> When running this unittest, I am facing this NPE:
> java.lang.NullPointerException
> at org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer.assignPointsToClusters(KMeansPlusPlusClusterer.java:91)
> This is the unittest:
> package org.fao.fisheries.chronicles.calcuation.cluster;
> import static org.junit.Assert.assertEquals;
> import static org.junit.Assert.assertTrue;
> import java.util.Arrays;
> import java.util.List;
> import java.util.Random;
> import org.apache.commons.math.stat.clustering.Cluster;
> import org.apache.commons.math.stat.clustering.EuclideanIntegerPoint;
> import org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer;
> import org.fao.fisheries.chronicles.input.CsvImportProcess;
> import org.fao.fisheries.chronicles.input.Top200Csv;
> import org.junit.Test;
> public class ClusterAnalysisTest {
> @Test
> public void testPerformClusterAnalysis2() {
> KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
> new Random(1746432956321l));
> EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
> new EuclideanIntegerPoint(new int[] { 1959, 325100 }),
> new EuclideanIntegerPoint(new int[] { 1960, 373200 }), };
> List<Cluster<EuclideanIntegerPoint>> clusters = transformer.cluster(Arrays.asList(points), 1, 1);
> assertEquals(1, clusters.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.