skills/cv/multimodal-prediction-union/SKILL.md
Combine match predictions from image embeddings, text similarity, and perceptual hash via set union for maximum recall
npx skillsauth add wenmin-wu/ds-skills cv-multimodal-prediction-unionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
In product/image matching, different signals (CNN embeddings, text TF-IDF, perceptual hash) each catch different true matches. Take the set union of all per-signal predictions to maximize recall. This is simpler and often better than learned fusion for retrieval tasks where precision can be traded for recall.
import numpy as np
import pandas as pd
def union_predictions(df, pred_columns):
"""Merge predictions from multiple signals via set union.
Args:
df: DataFrame where each pred_column contains arrays of matched IDs
pred_columns: list of column names with per-signal match arrays
Returns:
Series of unique merged match arrays
"""
def merge_row(row):
all_ids = np.concatenate([row[col] for col in pred_columns])
return np.unique(all_ids)
return df.apply(merge_row, axis=1)
# Usage: each column has arrays of matched item IDs
df['image_matches'] = find_matches(image_embeddings, ids, img_thresh)
df['text_matches'] = find_matches(text_embeddings, ids, txt_thresh)
df['hash_matches'] = phash_group_matches(df)
df['final_matches'] = union_predictions(
df, ['image_matches', 'text_matches', 'hash_matches']
)
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF