Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    CastError
Message:      Couldn't cast
files: list<item: struct<bytes: int64, path: string, sha256: string>>
  child 0, item: struct<bytes: int64, path: string, sha256: string>
      child 0, bytes: int64
      child 1, path: string
      child 2, sha256: string
generated_at: timestamp[s]
paper: struct<arxiv: string, openreview: string, title: string>
  child 0, arxiv: string
  child 1, openreview: string
  child 2, title: string
upstream_code: struct<commit: string, repo: string>
  child 0, commit: string
  child 1, repo: string
verdict: string
trials: int64
below_threshold_negative_control: struct<sigma2: double, d: int64, lloyd_escape_wrong_point: string, lloyd_escape_wrong_point_rate: do (... 130 chars omitted)
  child 0, sigma2: double
  child 1, d: int64
  child 2, lloyd_escape_wrong_point: string
  child 3, lloyd_escape_wrong_point_rate: double
  child 4, lloyd_keep_wrong_point: string
  child 5, lloyd_keep_wrong_point_rate: double
  child 6, theorem34_bound_rho_d4: double
  child 7, interpretation: string
above_threshold: list<item: struct<sigma2: double, d: int64, lloyd_escape_wrong_point: string, lloyd_escape_wrong_poi (... 118 chars omitted)
  child 0, item: struct<sigma2: double, d: int64, lloyd_escape_wrong_point: string, lloyd_escape_wrong_point_rate: do (... 106 chars omitted)
      child 0, sigma2: double
      child 1, d: int64
      child 2, lloyd_escape_wrong_point: string
      child 3, lloyd_escape_wrong_point_rate: double
      child 4, lloyd_keep_wrong_point: string
      child 5, lloyd_keep_wrong_point_rate: double
      child 6, theorem34_bound_rho_d4: double
threshold: struct<paper_eq13_sigma: double, paper_eq13_sigma2: double, note: string>
  child 0, paper_eq13_sigma: double
  child 1, paper_eq13_sigma2: double
  child 2, note: string
claim: string
to
{'claim': Value('string'), 'threshold': {'paper_eq13_sigma': Value('float64'), 'paper_eq13_sigma2': Value('float64'), 'note': Value('string')}, 'trials': Value('int64'), 'above_threshold': List({'sigma2': Value('float64'), 'd': Value('int64'), 'lloyd_escape_wrong_point': Value('string'), 'lloyd_escape_wrong_point_rate': Value('float64'), 'lloyd_keep_wrong_point': Value('string'), 'lloyd_keep_wrong_point_rate': Value('float64'), 'theorem34_bound_rho_d4': Value('float64')}), 'below_threshold_negative_control': {'sigma2': Value('float64'), 'd': Value('int64'), 'lloyd_escape_wrong_point': Value('string'), 'lloyd_escape_wrong_point_rate': Value('float64'), 'lloyd_keep_wrong_point': Value('string'), 'lloyd_keep_wrong_point_rate': Value('float64'), 'theorem34_bound_rho_d4': Value('float64'), 'interpretation': Value('string')}, 'verdict': Value('string')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 489, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2818, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2355, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2380, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2369, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2297, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              files: list<item: struct<bytes: int64, path: string, sha256: string>>
                child 0, item: struct<bytes: int64, path: string, sha256: string>
                    child 0, bytes: int64
                    child 1, path: string
                    child 2, sha256: string
              generated_at: timestamp[s]
              paper: struct<arxiv: string, openreview: string, title: string>
                child 0, arxiv: string
                child 1, openreview: string
                child 2, title: string
              upstream_code: struct<commit: string, repo: string>
                child 0, commit: string
                child 1, repo: string
              verdict: string
              trials: int64
              below_threshold_negative_control: struct<sigma2: double, d: int64, lloyd_escape_wrong_point: string, lloyd_escape_wrong_point_rate: do (... 130 chars omitted)
                child 0, sigma2: double
                child 1, d: int64
                child 2, lloyd_escape_wrong_point: string
                child 3, lloyd_escape_wrong_point_rate: double
                child 4, lloyd_keep_wrong_point: string
                child 5, lloyd_keep_wrong_point_rate: double
                child 6, theorem34_bound_rho_d4: double
                child 7, interpretation: string
              above_threshold: list<item: struct<sigma2: double, d: int64, lloyd_escape_wrong_point: string, lloyd_escape_wrong_poi (... 118 chars omitted)
                child 0, item: struct<sigma2: double, d: int64, lloyd_escape_wrong_point: string, lloyd_escape_wrong_point_rate: do (... 106 chars omitted)
                    child 0, sigma2: double
                    child 1, d: int64
                    child 2, lloyd_escape_wrong_point: string
                    child 3, lloyd_escape_wrong_point_rate: double
                    child 4, lloyd_keep_wrong_point: string
                    child 5, lloyd_keep_wrong_point_rate: double
                    child 6, theorem34_bound_rho_d4: double
              threshold: struct<paper_eq13_sigma: double, paper_eq13_sigma2: double, note: string>
                child 0, paper_eq13_sigma: double
                child 1, paper_eq13_sigma2: double
                child 2, note: string
              claim: string
              to
              {'claim': Value('string'), 'threshold': {'paper_eq13_sigma': Value('float64'), 'paper_eq13_sigma2': Value('float64'), 'note': Value('string')}, 'trials': Value('int64'), 'above_threshold': List({'sigma2': Value('float64'), 'd': Value('int64'), 'lloyd_escape_wrong_point': Value('string'), 'lloyd_escape_wrong_point_rate': Value('float64'), 'lloyd_keep_wrong_point': Value('string'), 'lloyd_keep_wrong_point_rate': Value('float64'), 'theorem34_bound_rho_d4': Value('float64')}), 'below_threshold_negative_control': {'sigma2': Value('float64'), 'd': Value('int64'), 'lloyd_escape_wrong_point': Value('string'), 'lloyd_escape_wrong_point_rate': Value('float64'), 'lloyd_keep_wrong_point': Value('string'), 'lloyd_keep_wrong_point_rate': Value('float64'), 'theorem34_bound_rho_d4': Value('float64'), 'interpretation': Value('string')}, 'verdict': Value('string')}
              because column names don't match

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

The Catastrophic Failure of the k-Means Algorithm in High Dimensions, and How Hartigan's Algorithm Avoids It

Summary

This repository provides the kmeansx library and scripts needed to reproduce the results of our paper, available as a preprint and accepted to ICML 2026 (ICML link TBA). Pre-computed results and reproduction scripts are available on Zenodo.

kmeansx implements Lloyd's and Hartigan's k-means algorithms in JAX, with a scikit-learn-style API. It also provides a wrapper around scikit-learn's Spectral Clustering and an SDP-based clustering implementation via CVXPY.

Installation

If you have a GPU and want to use it for computation, install JAX with CUDA support first:

pip install jax[cuda12]

Then install the package:

pip install .

Quick Start

kmeansx follows a scikit-learn-style API:

import kmeansx
import jax.random as jr

data = ...  # array of shape (n_samples, n_features)

kmeans = kmeansx.KMeans(
    n_clusters=...,
    n_init=...,
    max_iter=...,
    init=...,       # 'random', 'random_partition', or 'kmeans++'
    algorithm=...,  # 'Hartigan' or 'Lloyd'
)

result = kmeans.fit(
    key=jr.key(seed),
    data=data,
    output="best",  # 'best' returns the run with lowest k-means loss
                    # 'all'  returns all runs with an extra batch dimension
)

print(result)
# KmeansSolution(centroids=..., labels=..., loss=...)

Repository Structure

src/kmeansx/
├── kmeans/          # Lloyd and Hartigan k-means implementations (JAX)
├── metrics/         # Clustering evaluation metrics
├── _other_algos/    # Spectral clustering (sklearn wrapper) and SDP clustering (CVXPY)
└── svd_utils.py     # PCA and randomized SVD utilities
Downloads last month
122

Paper for Srishti280992/repro-the-catastrophic-failure-of-the-k-means-algorithm-in-high-dimensions-and-how-hartigan-s-al