Skip to content
Back to skills

Multimodal Prediction Union

ASecurity

Combine match predictions from image embeddings, text similarity, and perceptual hash via set union for maximum recall

  • 61 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
ai-agentspythonapi

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill multimodal-prediction-union --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Multimodal Prediction Union?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Multimodal Prediction Union
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-multimodal-prediction-union/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-multimodal-prediction-union)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cv-multimodal-prediction-union
description: Combine match predictions from image embeddings, text similarity, and perceptual hash via set union for maximum recall
domain: cv
---

# Multimodal Prediction Union

## Overview

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.

## Quick Start

```python
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']
)
```

## Key Decisions

- **Union over intersection**: maximizes recall at slight precision cost — appropriate for retrieval
- **Per-signal thresholds**: tune each modality's threshold independently before merging
- **Order doesn't matter**: set union is commutative — no need to prioritize signals
- **Diminishing returns**: typically 3-4 signals saturate; more signals add noise without recall gain

## References

- Source: [part-2-rapids-tfidfvectorizer-cv-0-700](https://www.kaggle.com/code/cdeotte/part-2-rapids-tfidfvectorizer-cv-0-700)
- Competition: Shopee - Price Match Guarantee

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…