Reference clustering, balanced-pair sampling and normalized error vectors
DefinitionPriceCapacities_UpperBound_SamplingVectorsclusteringcoresetsmetric-geometry
A reference clustering partitions a weighted metric input into retained data and positive-cost clusters. The sampler selects a finite balanced-pair distribution in each cluster, allocates draws in proportion to reference cost, and forms weighted error vectors for two independent realizations. These definitions specify the sampler and the vector families whose covering numbers enter the coreset size bounds. The distribution is selected by classical choice; its validity is established separately by Lemma 4.2.
Definition code
import Definitions.Def_PriceCapacities_UpperBound_Foundations
set_option autoImplicit true
set_option relaxedAutoImplicit false
set_option maxSynthPendingDepth 3
section
namespace CapCoreset
open Finset
variable {X : Type*} {ι : Type*} [Fintype ι]
section wsum
end wsum
variable [Nonempty ι]
noncomputable def dualF (D : X → ι → ℝ) (β : ι → ℝ) (x : X) : ℝ :=
Finset.univ.inf' Finset.univ_nonempty fun i => D x i + β i
noncomputable def tight (D : X → ι → ℝ) (β : ι → ℝ) (x : X) : Finset ι := by
classical exact Finset.univ.filter fun i => D x i + β i = dualF D β x
lemma tight_nonempty (D : X → ι → ℝ) (β : ι → ℝ) (x : X) : (tight D β x).Nonempty := by
classical
obtain ⟨i, -, hi⟩ := Finset.exists_mem_eq_inf' (Finset.univ_nonempty (α := ι))
(fun i => D x i + β i)
exact ⟨i, by simp [tight, dualF, hi]⟩
noncomputable def assignL (D : X → ι → ℝ) (β : ι → ℝ) (x : X) : ℝ :=
(tight D β x).inf' (tight_nonempty D β x) fun i => D x i
end CapCoreset
end
section
namespace CapCoreset
open Finset
section analysis
variable {V g : ℝ → ℝ} {K : ℝ}
end analysis
section transfer
variable {X : Type*} {ι : Type*} [Fintype ι] [Nonempty ι]
noncomputable def uncCost (W : WSet X) (D : X → ι → ℝ) : ℝ := wsum W (dualF D 0)
end transfer
end CapCoreset
end
section
namespace CapCoreset
open Finset
variable {X : Type*}
structure IsBalancedPair (C : WSet X) (r : X → ℝ) (a : ℝ) (B : WSet X) : Prop where
nonneg : IsNonneg B
supp_sub : B.support ⊆ C.support
card_le : B.support.card ≤ 2
mass_eq : mass B = 1
cost_eq : wsum B r = a
noncomputable def clusterSample (C : WSet X) {L m : ℕ} (B : Fin L → WSet X)
(ω : Fin m → Fin L) : WSet X :=
(mass C / m) • ∑ b, B (ω b)
end CapCoreset
end
section
namespace CapCoreset
open Finset
noncomputable def modCost {X : Type*} [PseudoMetricSpace X] (η : ℝ) (z : ℕ) (x a c : X) : ℝ :=
if η ^ z * dist a c ^ z ≤ dist x a ^ z then dist x c ^ z else dist a c ^ z
section pairs
variable {X : Type*}
variable [PseudoMetricSpace X] {ι : Type*} [Fintype ι] [Nonempty ι]
end pairs
end CapCoreset
end
section
namespace CapCoreset
open Finset
variable {X : Type*} [PseudoMetricSpace X]
noncomputable def optUncZ (k z : ℕ) [NeZero k] (P : WSet X) : ℝ :=
⨅ C : Fin k → X, uncCost P (powCost z C)
structure RefClustering (k z : ℕ) [NeZero k] (P : WSet X) (αref : ℝ) where
κ : ℕ
hκ : κ ≤ k
center : Fin κ → X
part : Fin κ → WSet X
retained : WSet X
nonneg : ∀ j, IsNonneg (part j)
retained_nonneg : IsNonneg retained
sum_eq : retained + ∑ j, part j = P
nearest : ∀ j, ∀ x ∈ (part j).support, ∀ i, dist x (center j) ≤ dist x (center i)
refc : X → X
refc_spec : ∀ j, ∀ x ∈ (part j).support, refc x = center j
mass_pos : ∀ j, 0 < mass (part j)
cost_pos : ∀ j, 0 < wsum (part j) fun x => dist x (center j) ^ z
approx : ∑ j, wsum (part j) (fun x => dist x (center j) ^ z) ≤ αref * optUncZ k z P
namespace RefClustering
variable {k z : ℕ} [NeZero k] {P : WSet X} {αref : ℝ} (A : RefClustering k z P αref)
noncomputable def rz (j : Fin A.κ) (x : X) : ℝ := dist x (A.center j) ^ z
noncomputable def Φ (j : Fin A.κ) : ℝ := wsum (A.part j) (A.rz j)
noncomputable def Φtot : ℝ := ∑ j, A.Φ j
abbrev DecompositionData (Y : Type*) := (l : ℕ) × ((Fin l → ℝ) × (Fin l → WSet Y))
def IsDecomposition (C : WSet X) (r : X → ℝ) (w : DecompositionData X) : Prop :=
(∀ s, 0 ≤ w.2.1 s) ∧ (∀ s, IsBalancedPair C r (wsum C r / mass C) (w.2.2 s)) ∧
∑ s, w.2.1 s = mass C ∧ ∑ s, (w.2.1 s / mass C) • w.2.2 s = (mass C)⁻¹ • C
noncomputable def selected (j : Fin A.κ) : DecompositionData X :=
Classical.epsilon (IsDecomposition (A.part j) (A.rz j))
noncomputable def L (j : Fin A.κ) : ℕ := (A.selected j).1
noncomputable def t (j : Fin A.κ) : Fin (A.L j) → ℝ := (A.selected j).2.1
noncomputable def B (j : Fin A.κ) : Fin (A.L j) → WSet X := (A.selected j).2.2
noncomputable def m (T : ℝ) (j : Fin A.κ) : ℕ := ⌈T * A.Φ j / A.Φtot⌉₊
abbrev Ω (T : ℝ) := (j : Fin A.κ) → Fin (A.m T j) → Fin (A.L j)
noncomputable def prob (T : ℝ) (ω : A.Ω T) : ℝ :=
∏ j, ∏ b, A.t j (ω j b) / mass (A.part j)
noncomputable def sample (T : ℝ) (ω : A.Ω T) : WSet X :=
A.retained + ∑ j, clusterSample (A.part j) (A.B j) (ω j)
abbrev Pairs (T : ℝ) := (j : Fin A.κ) × Fin (A.m T j)
noncomputable def pair (T : ℝ) (ω : A.Ω T) (s : A.Pairs T) : WSet X :=
(mass (A.part s.1) / A.m T s.1) • A.B s.1 (ω s.1 s.2)
noncomputable def errVec {ι : Type*} [Fintype ι] [Nonempty ι] (T η : ℝ) (ω ω' : A.Ω T)
(D : X → ι → ℝ) (β : ι → ℝ) (s : A.Pairs T) : ℝ :=
(wsum (A.pair T ω s) (dualF D β) - wsum (A.pair T ω' s) (dualF D β)) /
Real.sqrt (A.Φtot * (A.Φtot + wsum (A.sample T ω) (assignL D β) +
wsum (A.sample T ω') (assignL D β)) / (T * η ^ (z - 2)))
noncomputable def modMat (η : ℝ) (C : Fin k → X) : X → Fin k → ℝ :=
fun x i => modCost η z x (A.refc x) (C i)
def modErrVecs (T η : ℝ) (ω ω' : A.Ω T) : Set (A.Pairs T → ℝ) :=
{v | ∃ (C : Fin k → X) (β : Fin k → ℝ), v = A.errVec T η ω ω' (A.modMat η C) β}
def errVecs (T : ℝ) (ω ω' : A.Ω T) : Set (A.Pairs T → ℝ) :=
{v | ∃ (C : Fin k → X) (β : Fin k → ℝ), v = A.errVec T 1 ω ω' (powCost z C) β}
end RefClustering
namespace A1
end A1
end CapCoreset
end
section
namespace CapCoreset
open Finset
namespace RefClustering
variable {X : Type*} [PseudoMetricSpace X] {k z : ℕ} [NeZero k] {P : WSet X} {αref : ℝ}
(A : RefClustering k z P αref)
def gVecs (T η : ℝ) (D : (Fin k → X) → X → Fin k → ℝ) (ω ω' : A.Ω T) :
Set (A.Pairs T → ℝ) :=
{v | ∃ (C : Fin k → X) (β : Fin k → ℝ), v = A.errVec T η ω ω' (D C) β}
variable {T η : ℝ} {D : (Fin k → X) → X → Fin k → ℝ}
end RefClustering
namespace T55
end T55
end CapCoreset
end
section
namespace CapCoreset
open Finset
noncomputable def clipI (lo hi t : ℝ) : ℝ := max lo (min t hi)
noncomputable def clipCost {X : Type*} [PseudoMetricSpace X] (η : ℝ) (z : ℕ) (x a c : X) : ℝ :=
clipI (dist a c ^ z - dist x a ^ z / η ^ (z - 1)) (dist a c ^ z + dist x a ^ z / η ^ (z - 1))
(dist x c ^ z)
section clipcost
variable {X : Type*} [PseudoMetricSpace X] {z : ℕ} {η : ℝ}
end clipcost
namespace RefClustering
variable {X : Type*} [PseudoMetricSpace X] {k z : ℕ} [NeZero k] {P : WSet X} {αref : ℝ}
(A : RefClustering k z P αref)
noncomputable def clipMat (η : ℝ) (C : Fin k → X) : X → Fin k → ℝ :=
fun x i => clipCost η z x (A.refc x) (C i)
end RefClustering
namespace C95
variable {k : ℕ} {ιM : Type*}
end C95
end CapCoreset
end
Source
Prabhu, Schwiegelshohn and Shyam, The Price of Capacities for Clustering Coresets, Sections 4, 5 and 9. https://github.com/sudarshanshy/capacitated-coresets-upper-bounds/blob/1308e6ff34ce68bed31fb12f40828344a314a5c5/CapacitatedCoresetsUpperBounds/Framework.lean