patchdist_fit — SPC anomaly_patch op

• Data kinds: video → table

• Call: import fullseye as fs; fs.ledger.patchdist_fit(stack, patch=8, stride=4, scales=(1.0, 2.0, 4.0), groups=('gradient', 'gabor', 'lbp'), n_orient=4, shrinkage='auto', n_dims=None, seed=0, ridge=1e-06, pool='position') (implementation को सीधे call करना हो तो import anomaly_patch; anomaly_patch.patchdist_fit(stack, patch=8, stride=4, scales=(1.0, 2.0, 4.0), groups=('gradient', 'gabor', 'lbp'), n_orient=4, shrinkage='auto', n_dims=None, seed=0, ridge=1e-06, pool='position'), registry से लेना हो तो opsspc.get("patchdist_fit"))

उपयोग

अच्छे images से हर grid position पर patch feature का normal distribution सीखना (shrinkage घोषित, singular covariance अस्वीकृत) (table)।

> नीचे का विस्तृत विवरण मूल text में है — सारांश और headings का अनुवाद हो चुका है।

stack is (n, H, W) or (n, H, W, 3) of good images, n >= 2, registered well enough that a grid cell sees the same content. The feature is patch_features (same parameters). At every cell the mean and the covariance (maximum likelihood, divided by n) of the D-dimensional feature are estimated; n <= D makes the covariance singular, so the shrinkage toward tr(S)/D * I is declared: "auto" is the Ledoit–Wolf analytic intensity per position, a number in (0, 1] fixes it, "none" (or 0) is accepted only when n - 1 >= D and the covariance is positive definite and otherwise refused. n_dims keeps a seeded random subset of the D dimensions (the memory trick of the original method), ridge (relative to the median variance, applied unless shrinkage="none") is a numerical floor against exactly constant channels. pool="position" (default) estimates one distribution per grid cell, right when the content is registered; pool="global" estimates ONE distribution from the patches of all cells and images (n * gh * gw samples, overlapping patches are not independent), right for a stationary texture whose content at a cell differs from image to image and which has far more samples than dimensions.

Returns the model: per-position mean and precision (inverse of the shrunk covariance), shrinkage_map and its mean shrinkage_mean, n_train, dim, dims (kept channels), the feature parameters and image_shape. Pass it to patchdist_score.

Raises ValueError for fewer than two images, a singular covariance with shrinkage="none", a constant feature that stays singular, or invalid parameters.

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• poc_patch_anomaly — py -3.11 examples/poc_patch_anomaly.py

वे अगले ops जिनसे type जुड़ता है (table को input के रूप में लेते हैं)

msa_anova_table · msa_gauge_rr · msa_bias_linearity · msa_attribute_agreement · gum_standard_uncertainty · gum_propagate · gum_expanded · gum_monte_carlo

इसी category के (anomaly_patch)

patch_features · patchdist_score · patchbank_fit · patchbank_score


*Provenance: anomaly_patch.py — SPC operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.