Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDBSCAN, input: n×1 matrix, NullPointerException #20

Open
Fern-Parker opened this issue Mar 24, 2023 · 1 comment
Open

HDBSCAN, input: n×1 matrix, NullPointerException #20

Fern-Parker opened this issue Mar 24, 2023 · 1 comment

Comments

@Fern-Parker
Copy link

Fern-Parker commented Mar 24, 2023

@tgsmith61591 Hi. When HDBSCAN took as input a n×1 matrix, I met the following NullPointerException. But it works well with DBSCAN . The input was obtained by reading a csv file.
Exception in thread "main" java.lang.NullPointerException
at com.clust4j.algo.HDBSCAN.doLabeling(HDBSCAN.java:1327)
at com.clust4j.algo.HDBSCAN.getLabels(HDBSCAN.java:1592)
at com.clust4j.algo.HDBSCAN.treeToLabels(HDBSCAN.java:1643)
at com.clust4j.algo.HDBSCAN.fit(HDBSCAN.java:1356)
at com.clust4j.algo.HDBSCANParameters.fitNewModel(HDBSCANParameters.java:50)
Any help will be greatly appreciated!

@vbmacher
Copy link

vbmacher commented Oct 2, 2023

This is a test case:

      double[][] pts = new double[][] {
        {39.3747, -120.032},
        {32.2699, -110.9853},
        {39.5111, -119.9575},
        {32.2699, -110.9853},
        {39.4725, -119.9981},
        {32.2699, -110.9853},
        {39.3885, -120.0248},
        {32.2699, -110.9853},
        {39.4725, -119.9984},
        {32.2699, -110.9853},
        {39.4731, -119.9977},
        {32.2699, -110.9853},
        {39.3769, -120.071},
        {32.2699, -110.9853},
        {39.389, -120.0248}
      };

Array2DRowRealMatrix matrix = new Array2DRowRealMatrix(pts);
new HDBSCANParameters(2).setMinClustSize(2).fitNewModel(matrix).getLabels

throws:

java.lang.NullPointerException
	at com.clust4j.algo.HDBSCAN.doLabeling(HDBSCAN.java:1327)
	at com.clust4j.algo.HDBSCAN.getLabels(HDBSCAN.java:1602)
	at com.clust4j.algo.HDBSCAN.treeToLabels(HDBSCAN.java:1653)
	at com.clust4j.algo.HDBSCAN.fit(HDBSCAN.java:1366)
	at com.clust4j.algo.HDBSCANParameters.fitNewModel(HDBSCANParameters.java:50)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants