← Back to all sparks
A

anticlust

INFRA · APIS
Velocity0.0

Subset Partitioning via Anticlustering

Anticlustering keeps absorbing constraints — must-link, cannot-link, blocks, missing data

anticlusteringexperimental-designconstraint-solvingoptimizationstimulus-selection
Current state
anticlust partitions a set of items into groups that are as similar to each other as possible — assembling matched stimulus sets, balanced experimental conditions, comparable teaching groups. The current surface is one function, anticlustering(), with a growing list of things it will honour: must-link and cannot-link constraints, categorical variables as factors, NAs, blocking by a categorical level, and a choice among exact solvers and heuristics.
Where it's heading
Two years of releases have gone almost entirely into constraint handling and input tolerance rather than new objectives. The methods list grew by absorbing outside work — the three-phase search of Yang et al. contributed by an external author, a 2PML heuristic for must-link problems, a Gurobi backend for the exact formulations. Meanwhile categories_to_binary() has been rewritten twice, which is where the recent bugs have come from.
Prediction
The constraint types now interact combinatorially — blocks, must-link, cannot-link, missing values and each objective — and the last two releases were both regressions in the encoding layer underneath them. Consolidating that layer is the more likely next move than another solver.

Recent moves

  1. 4mo ago

    One-hot encoding regression from 0.8.13 reverted

    A correction to the internals that turn categorical variables into the binary columns the objectives operate on — broken across two prior releases. The encoding layer has now been the source of both of the last two fixes.

    View source ↗
  2. 8mo ago

    blocks argument applies anticlustering level by level

    A blocks argument runs anticlustering sequentially within the levels of a categorical variable, the standard blocked-design pattern, and categories_to_binary() stops erroring on single-level factors. Continues the pattern of teaching one function to accept more shapes of input.

    View source ↗
  3. 9mo ago

    Missing values, factor columns, and the three-phase search

    The broadest input-tolerance release in the window: anticlustering() handles NAs and takes factor columns directly, must-link constraints work with the kplus and variance objectives, and method='3phase' exposes the Yang et al. algorithm contributed by an outside author.

    View source ↗
  4. 1y ago

    Edge cases in the previous release's cannot-link handling

    A same-day follow-up patching corners of the vectorised cannot-link support shipped 35 minutes earlier.

    View source ↗
  5. 1y ago

    Vector cannot-link constraints skip the solver entirely

    cannot-link constraints can be given as a vector, and when they come from a grouping variable the problem is solved without invoking a solver at all. A constraint that was expensive to express becomes the cheap path.

    View source ↗
  6. 1y ago

    Uncaught test error flagged by CRAN additional checks

    A CRAN-driven patch to the test suite with no change to package behaviour.

    View source ↗