make_partitions: Create Data Partitions Using Clustering

View source: R/make_partitions.R

make_partitionsR Documentation

Create Data Partitions Using Clustering

Description

Partitions data support into clusters using Voronoi-like diagrams. Standardization for clustering is handled internally; centers, knots, and the returned assign_partition function are all on the **raw (natural) scale** of the original predictors.

Usage

make_partitions(
  data,
  cluster_args,
  cluster_on_indicators,
  K,
  parallel,
  cl,
  do_not_cluster_on_these,
  neighbor_tolerance,
  standardize = TRUE,
  standardize_mode = "auto",
  dummy_adder = 0,
  dummy_dividor = 0
)

Arguments

data

Numeric matrix of predictor variables (raw scale)

cluster_args

Parameters for clustering

cluster_on_indicators

Logical to include binary predictors

K

Number of partitions minus 1 (K)

parallel

Logical to enable parallel processing

cl

Cluster object for parallel computation

do_not_cluster_on_these

Columns to exclude from clustering

neighbor_tolerance

Scaling factor for neighbor detection

standardize

Logical; whether to standardize data internally before clustering. Should equal standardize_predictors_for_knots from lgspline.fit. Default TRUE.

standardize_mode

Character; "auto" (default) selects "minmax" for a single effective clustering dimension and "normal" for multiple dimensions. Can be forced to either value.

dummy_adder

Small constant added to numerator during standardization to avoid exact-zero values (matches lgspline.fit's dummy_adder). Default 0.

dummy_dividor

Small constant added to denominator during standardization to avoid division by zero (matches lgspline.fit's dummy_dividor). Default 0.

Value

A list containing:

centers

Cluster center coordinates on the raw scale.

knots

Knot points between centers on the raw scale.

assign_partition

Function that accepts raw-scale new data and returns integer-like partition assignments (0.5, 1.5, ...).

neighbors

List of neighboring partition indices.

standardize_transf

The forward standardization function used internally (for diagnostic use only).

standardize_inv_transf

The inverse standardization function (for diagnostic use only).

centers_std

Cluster centers on the standardized scale (for diagnostic use only).


lgspline documentation built on May 8, 2026, 5:07 p.m.