
Claude Skills by wenmin-wu
github.com/wenmin-wuLearns optimal per-model blending weights via Optuna optimization, supporting negative weights for error cancellation.
Trains a transformer with MarginRankingLoss on text pairs (more/less toxic), learning to rank rather than classify when only pairwise preference labels are available.
Evaluates ranking models by computing the fraction of preference pairs where the model correctly scores the preferred item higher.
Converts pairwise binary predictions into continuous ranks via temperature-scaled softmax weighted sum over anchor positions.
Use Pearson correlation coefficient as evaluation metric for semantic similarity regression tasks, selecting best checkpoint by correlation rather than loss
Filters predicted NER spans using per-class minimum word-count and mean-probability thresholds to reduce false positives.
Prepends prompt question or full prompt text to input with SEP token for context-aware text evaluation.
Stores model softmax probabilities as uint8 (0-255) to reduce RAM by 4x during multi-model ensemble inference.
Extracts established readability scores (Flesch, Gunning FOG, ARI, Coleman-Liau) as numeric features from text.
Supplements transformer NER predictions with regex-based detection for structured entities (email, phone, URL), aligning regex matches back to token indices via subsequence search.
Split multi-sentence parallel pairs into aligned sentence pairs to expand training data for seq2seq models
Prepend a sentiment token as the query in a QA-style input to condition span extraction on sentiment class without architectural changes
Promotes a predicted short answer span to its enclosing long-answer candidate by matching token boundaries against pre-extracted document structure.
Uses simulated annealing to select the optimal subset of candidate terms for a boolean search query, maximizing a retrieval metric like AP@K.
Stratifies CV folds by both target label AND data source to prevent source-specific bias in each fold.
Clean up character-level span predictions by removing isolated space characters at span boundaries
Train per-class spaCy NER models to extract task-specific spans as custom named entities with compounding batch sizes
Evaluates NER span predictions using bidirectional word-index overlap (>=50% both ways) to compute micro-F1 over predicted vs ground-truth spans.
Drop entire embedding channels consistently across all timesteps — preserves temporal structure better than element-wise dropout
Custom Keras callback that evaluates Spearman correlation on validation data each epoch with optional early stopping.
Applies domain-aware spelling correction before transformer input to separate spelling errors from content quality.
Uses square root of MSE as training loss to directly optimize for RMSE evaluation metric alignment.
Format multi-field tabular data into a structured natural language prompt with labeled sections for encoder or LLM classification
Controls whether all subtokens or only the first subtoken of each word receive NER labels during training and inference.
Enrich model input by mapping categorical codes to human-readable taxonomy descriptions and concatenating them as context for transformer models
Fits TF-IDF vectorizer on test set first to extract vocabulary, then retrains on train set using that vocabulary for feature consistency.
Computes n-gram overlap counts/ratios and NER entity overlap between reference and generated text as features.
High n-gram TF-IDF (3-5 grams) with sublinear TF feeding into a weighted soft-voting ensemble of traditional ML classifiers.
Encodes text pairs by computing the absolute difference of their TF-IDF vectors, collapsing a pair into a single fixed-length feature vector.
Converts TF-IDF top-k terms into field-scoped boolean OR queries for structured document retrieval from a full-text index.
TF-IDF similarity retrieval from a translation memory with SequenceMatcher reranking as a fallback or ensemble component
Computes word overlap ratio between two texts weighted by inverse corpus frequency, giving rare shared words more importance than common ones.
Filters candidate span indices through a token map to skip special tokens, then cross-products top-k start/end indices with length constraints.
Map token-level classifier outputs back to character-level spans via offset mapping, thresholding, and contiguous grouping
Auto-detects TPU vs CPU/GPU at runtime and wraps model construction in the appropriate TensorFlow distribution strategy with scaled batch size.
Distributes inference across multiple TPU cores using torch_xla, each core writing a CSV shard, then merges shards via groupby mean.
Trains a transformer at shorter sequence length for speed, then runs inference at a longer sequence length to capture more context, exploiting position embedding generalization.
Extracts frozen embeddings from multiple pretrained transformers and trains SVR on the concatenated features.
Freezes transformer embedding and lower encoder layers to reduce memory, speed up training, and stabilize fine-tuning.
Two-stage stacking: transformer predictions plus hand-crafted features feed into a LightGBM meta-learner.
Multi-rule regex pipeline to clean seq2seq translation outputs — deduplicate phrases, fix punctuation, remove artifacts
Fine-tunes a bi-encoder with triplet loss using retrieval-mined hard negatives for dense similarity search.
Two-stage pipeline where an unsupervised bi-encoder retrieves KNN candidates and a supervised cross-encoder reranks them with sigmoid thresholding
Samples N items uniformly by stride from a variable-length list, always preserving the first and last elements, to fit long sequences into a fixed token budget.
After training on the primary split, continues fine-tuning on the validation set to adapt the model to the target distribution before inference.
Exclude bias terms and LayerNorm weights from weight decay to prevent regularization from distorting normalization layers
Learns a weighted combination of CLS embeddings across all transformer layers instead of using only the last layer.
Builds a Whoosh full-text search index over documents and queries it with boolean operators, field scoping, and proximity matching.
Uses Word2Vec vocabulary rank as a word frequency proxy for Norvig-style spell correction, avoiding the need for a separate frequency corpus.
Stratifies CV folds by annotator/worker ID to prevent annotator style leakage across train and validation splits in crowd-sourced datasets.