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

Error: Islands must be larger than the quorum. #461

Open
benjaminrhoyle opened this issue Sep 9, 2024 · 2 comments
Open

Error: Islands must be larger than the quorum. #461

benjaminrhoyle opened this issue Sep 9, 2024 · 2 comments
Assignees
Labels
question Further information is requested region

Comments

@benjaminrhoyle
Copy link

benjaminrhoyle commented Sep 9, 2024

I'm trying to use the SKATER model, and continue to run into issues with the ValueError:
Islands must be larger than the quorum. If not, drop the small islands and solve for clusters in the remaining field.

I've been following the examples provided on their website with no success. I'm using spopt 0.6.1.

sf_kwds = dict(
    dissimilarity=skm.manhattan_distances,
    affinity=None,
    reduction=np.sum,
    center=np.mean
)

model = Skater(
    gdf = cluster_zips_scaled, 
    w = weights,
    attrs_name = ['counter'],
    n_clusters = 6, # k_optimal
    floor = 98,
    trace = False,
    islands = "increase",
    spanning_forest_kwds = sf_kwds)
model.solve()

cluster_zips_scaled[f"skater{k_optimal}_label"] = model.labels_

My weights dictionary has no islands, and there are 636 geometries I'm trying to cluster into 6 clusters, and I want at least 98 geometries in each cluster. Given the weights, all geometries border at least one other geometry.

Any help would be appreciated.

@jGaboardi jGaboardi added question Further information is requested region labels Sep 9, 2024
@knaaptime
Copy link
Member

knaaptime commented Sep 10, 2024

sorry, it's really hard to diagnose without a peek at your data/weights. Any chance you can provide a reprex?

@ljwolf
Copy link
Member

ljwolf commented Nov 13, 2024

The error is somewhat misleading due to our change in terminology. The error should be warning about disconnected components, not islands.

Are there disconnected subgraphs in weights that have more than 98 observations? You can check the weights.connected_components_, and can dig into it further using scipy.sparse.csgraph.connected_components() on your weights.sparse to investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested region
Projects
None yet
Development

No branches or pull requests

4 participants