pelinker.config¶
ClusterCompositionSnapshot
dataclass
¶
Mention-weighted mixture of KB property labels per HDBSCAN cluster after Linker.fit.
- :attr:
global_property_mass— total mention count per property in the fitted corpus (denominator for “fraction of that property’s mass” views). - :attr:
cluster_within_fraction— within each cluster, each property’s share of that cluster’s mention mass (sums to 1.0 per cluster). - :attr:
cluster_fraction_of_property_mass— for each cluster and property,mentions(cluster ∩ property) / global_property_mass[property](how much of that property’s corpus sits in this cluster; sums to ≤ 1.0 across disjoint cluster rows for a fixed property, excluding double-counting issues from overlapping keys).
Source code in pelinker/config.py
ClusteringOptimizationConfig
dataclass
¶
Configuration for clustering optimization grid search.
Source code in pelinker/config.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
ambient_screener = field(default_factory=NegativeScreenerConfig)
class-attribute
instance-attribute
¶
Negative-class screening before PCA→UMAP (see :class:NegativeScreenerConfig).
base_seed = 13
class-attribute
instance-attribute
¶
Seed for stratified selection draws; per-bootstrap seed is base_seed + sample_index.
batch_size = 1000
class-attribute
instance-attribute
¶
Rows per batch when reading mention-level embedding parquet (not encoder batch size).
clustering_grid_step = 5
class-attribute
instance-attribute
¶
Step between consecutive min_cluster_size values on the grid (numpy.arange step).
clustering_sample_rows = None
class-attribute
instance-attribute
¶
Max mention rows per clustering bootstrap draw (stratified). None = use all loaded rows.
grid_cluster_count_reward = 0.0
class-attribute
instance-attribute
¶
Weight on log(n_clusters / n_ref) added to the grid objective (0 = disabled).
grid_derivative_rel_tol = 0.12
class-attribute
instance-attribute
¶
|df/dx| below this times max|df/dx| counts as “derivative near zero” on the smoothed curve.
grid_n_entities = None
class-attribute
instance-attribute
¶
Reference entity count for the cluster-count term; when None, uses max mean cluster count on the grid.
grid_objective = 'dbcv_ari_mean_minmax'
class-attribute
instance-attribute
¶
Which scalar to optimize on the grid (single metric or pooled DBCV+ARI; see clustering_grid).
grid_plateau_fraction = 0.92
class-attribute
instance-attribute
¶
Plateau threshold on the smoothed curve: y_min + this * (y_max - y_min) (finite values only).
grid_smooth_window = 3
class-attribute
instance-attribute
¶
Odd-length centered moving-average window for smoothing f(x). Even values are bumped up by one.
min_scale = None
class-attribute
instance-attribute
¶
Lower bound (inclusive) for the min_cluster_size grid.
When None, defaults to max(1, min_class_size // 2).
optimization_method = 'mean'
class-attribute
instance-attribute
¶
How to build the objective f(min_cluster_size) before smoothing (mean / lower_bound / weighted).
projection_screener = field(default_factory=ManifoldOovScreenerConfig)
class-attribute
instance-attribute
¶
Validation config for manifold OOV model selection (analysis reporting only).
resolved_min_scale()
¶
Inclusive start of the min_cluster_size grid (HDBSCAN hyperparameter).
EmbeddingModelMetadata
dataclass
¶
Describes which embedding backbones/layers produced the model (saved with the Linker).
Source code in pelinker/config.py
EmbeddingSourceSpec
dataclass
¶
One backbone + layer selection (e.g. for a single encoder or one branch of a fused model).
Source code in pelinker/config.py
EmbeddingTrainingConfig
dataclass
¶
Inputs and runtime settings used only while embedding the corpus (not part of model identity).
Source code in pelinker/config.py
encoder_batch_size = 200
class-attribute
instance-attribute
¶
How many table rows are encoded per transformer forward pass; lower if GPU memory is tight.
input_buffer_rows = 1000
class-attribute
instance-attribute
¶
Rows read per pandas.read_csv(..., chunksize=...) pass over the text table (I/O buffer only).
max_input_buffers = None
class-attribute
instance-attribute
¶
If set, stop after this many text-table read passes (each up to input_buffer_rows rows).
negative_label = NEGATIVE_LABEL
class-attribute
instance-attribute
¶
Entity label to use for synthetic negative rows.
negative_seed = 13
class-attribute
instance-attribute
¶
Optional random seed for deterministic negative sampling.
negatives_per_positive = 0.0
class-attribute
instance-attribute
¶
Number of random negative mentions to sample per positive mention.
KBConfig
dataclass
¶
Metadata for the knowledge base packaged with a fitted Linker.
Source code in pelinker/config.py
entity_count = None
class-attribute
instance-attribute
¶
Set after fit from vocabulary size when None at construction time.
LinkerFitConfig
dataclass
¶
Parquet read + mention filters + screener settings for :meth:~pelinker.model.Linker.fit.
Source code in pelinker/config.py
base_seed = 13
class-attribute
instance-attribute
¶
Seed for stratified clustering draws; draw seed is base_seed + clustering_sample_index.
clustering_sample_index = 0
class-attribute
instance-attribute
¶
Bootstrap index for the clustering subsample (same contract as model selection sample_idx).
clustering_sample_rows = None
class-attribute
instance-attribute
¶
Max mention rows per clustering bootstrap draw (stratified). None = use all loaded rows.
diagnostics_random_state = 0
class-attribute
instance-attribute
¶
Stratified subsample seed for training diagnostics.
diagnostics_sample_size = 20000
class-attribute
instance-attribute
¶
Max rows of :class:~pelinker.reporting.LinkerFitDiagnostics stored on the fit report.
screener_max_rows = 100000
class-attribute
instance-attribute
¶
Max rows for ambient + projection screener training when using the full frame (stratified). None = no cap.
screener_seed = 13
class-attribute
instance-attribute
¶
Random seed for the stratified screener training draw when using the full frame.
to_clustering_sample_config()
¶
Build a :class:ClusteringOptimizationConfig for load + subsample helpers.
Source code in pelinker/config.py
ManifoldOovScreenerConfig
dataclass
¶
3D (residual, Mahalanobis, spectral entropy) OOV score model; predict-time gate only.
Source code in pelinker/config.py
MentionFrameLoadConfig
dataclass
¶
Shared mention-level parquet load and pre-subsample filters.
Source code in pelinker/config.py
drop_rare_entities = False
class-attribute
instance-attribute
¶
When true, drop KB entities with fewer than :attr:min_mentions_per_entity rows.
max_mentions_negative = None
class-attribute
instance-attribute
¶
Cap for :attr:~NegativeScreenerConfig.negative_label; None = exempt.
max_mentions_per_entity = None
class-attribute
instance-attribute
¶
Cap mention rows per KB entity (seeded); None = no cap.
NegativeScreenerConfig
dataclass
¶
Binary LDA/SVM screen for negative_label vs KB mentions before PCA→UMAP.
Source code in pelinker/config.py
kind = 'lda'
class-attribute
instance-attribute
¶
Estimator persisted on :class:~pelinker.model.Linker (Linker.screener).
TransformConfig
dataclass
¶
Configuration for the embedding transformation pipeline.
Source code in pelinker/config.py
cluster_viz_components = 3
class-attribute
instance-attribute
¶
Number of dimensions for cluster-space visualization (default: 3).
cluster_viz_method = 'pca'
class-attribute
instance-attribute
¶
Reducer applied to clustering UMAP coords: pca (linear) or umap.
cluster_viz_umap_metric = 'euclidean'
class-attribute
instance-attribute
¶
Distance metric for cluster-space UMAP viz (only when cluster_viz_method='umap').
pca_components = 50
class-attribute
instance-attribute
¶
Number of principal components to keep after PCA reduction.
pca_seed = 13
class-attribute
instance-attribute
¶
Random seed for PCA and cluster-viz PCA.
umap_components = 4
class-attribute
instance-attribute
¶
Number of UMAP dimensions for clustering (typically 3-5).
umap_metric = 'cosine'
class-attribute
instance-attribute
¶
Distance metric for UMAP (default: 'cosine').
umap_seed = None
class-attribute
instance-attribute
¶
UMAP random seed; None enables parallel UMAP (non-reproducible). Cluster-viz UMAP uses umap_seed + 1 when set.