pelinker.cli.fit¶
FitCliConfig
dataclass
¶
Hydra config for python -m pelinker.cli.fit.
Source code in pelinker/cli/fit.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
clustering_sample_index = 0
class-attribute
instance-attribute
¶
Bootstrap index for clustering subsample (match 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.
distillation_on_failure = 'warn'
class-attribute
instance-attribute
¶
warn keeps the fitted model and records the failure; raise aborts the fit.
entity_head_hidden_layers = None
class-attribute
instance-attribute
¶
MLP hidden sizes for compact mode; default [256, 128, 128] when omitted.
entity_head_holdout_fraction = 0.15
class-attribute
instance-attribute
¶
Rows withheld from entity-head training to measure distillation fidelity.
Set 0.0 to train on every row and skip the measurement (pre-fidelity behaviour).
entity_head_holdout_group_col = 'pmid'
class-attribute
instance-attribute
¶
Column kept whole across the holdout split, so correlated mentions from one document cannot straddle it and inflate the measured agreement.
mention_cap_seed = None
class-attribute
instance-attribute
¶
Seed for per-entity mention cap; defaults to seed when omitted.
min_cluster_size = None
class-attribute
instance-attribute
¶
Explicit HDBSCAN min_cluster_size. Omit to resolve from scale_curve_path,
or fall back to 20 when neither is given. An explicit value always wins.
pca_components = None
class-attribute
instance-attribute
¶
PCA components; omit to take the selection report's value, else 100.
pca_seed = 13
class-attribute
instance-attribute
¶
Random seed for PCA and cluster-viz PCA.
projection_enabled = True
class-attribute
instance-attribute
¶
When false, skip 3D manifold OOV score model (no predict-time gate from that path).
scale_curve_path = None
class-attribute
instance-attribute
¶
scale_curve.json from pelinker-scale-curve. When set (and
min_cluster_size is not), min_cluster_size is extrapolated to this fit's
realized manifold row count instead of transferred verbatim from the selection run.
screener_kind = 'lda'
class-attribute
instance-attribute
¶
lda or svm; persisted as :attr:~pelinker.model.Linker.screener.
seed = 13
class-attribute
instance-attribute
¶
Bootstrap seed for clustering subsample draws (base_seed); also default for mention-cap and screener draws.
selection_report = None
class-attribute
instance-attribute
¶
selected_hyperparameters.json (or the report dir containing it) from
pelinker-model-selection / pelinker-dim-selection.
Fills in pca_components, umap_dim, umap_n_neighbors and
min_cluster_size when those are not set explicitly here. Explicit overrides always
win, and any disagreement is logged rather than silently resolved.
umap_dim = None
class-attribute
instance-attribute
¶
UMAP output dimension; omit to take the selection report's value, else 8.
umap_n_neighbors = None
class-attribute
instance-attribute
¶
UMAP n_neighbors; omit for the library default (15). Scale-dependent — see
pelinker-scale-curve when the fit N differs markedly from the selection N.
umap_seed = None
class-attribute
instance-attribute
¶
UMAP random seed; omit (None) for parallel UMAP. Set for reproducible production fits.
fit(cfg)
¶
Run embedding (optional), fit a Linker from parquet(s) (optional), and write outputs.
Paths (no implicit fallbacks — missing required paths raise):
embeddings_parquet: output path(s) forembed_only/bothstage (A), or input parquet(s) forfit_only/bothstage (B).report_path: directory; fit stages writelinker_fit.clustering_report.json.gz,linker_fit.cluster_composition.json.gz, andlinker_fit.kb_out.jsonthere.model_path: filesystem path passed toLinker.dumpfor fit stages.
Pipelines:
pipeline=auto: embed then fit ifinput_text_table_pathis set; else fit from parquet.pipeline=embed_only: write parquet(s) only (model_path/report_pathnot used).pipeline=fit_only: fit from existing parquet(s); requiresmodel_pathandreport_path.pipeline=both: text table + embed then fit; requiresmodel_pathandreport_path.
Multiple embeddings_parquet values fuse in list order (inner join on pmid/entity/mention).
Set model_types / layers_specs (or scalars) so embedding_metadata.sources matches;
or infer model_type / layers_spec from each filename stem when lists are omitted.
Source code in pelinker/cli/fit.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | |