Skip to content
Back to skills

Majority Vote Submission Blend

ASecurity

Blend multiple submission CSVs by row-wise majority voting on discrete predictions to produce a more robust final output

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
code-qualitypythongo

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill majority-vote-submission-blend --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Majority Vote Submission Blend?

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

Security grade badge for Majority Vote Submission Blend
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-majority-vote-submission-blend/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-majority-vote-submission-blend)

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: tabular-majority-vote-submission-blend
description: Blend multiple submission CSVs by row-wise majority voting on discrete predictions to produce a more robust final output
---

# Majority Vote Submission Blend

## Overview

When you have multiple independently trained pipelines producing discrete class predictions, majority voting is the simplest and most robust blending strategy. Unlike rank averaging or weighted blending (which require continuous scores), majority voting works directly on integer labels and is especially effective for ordinal classification where averaging can land between classes.

## Quick Start

```python
import pandas as pd

def majority_vote_blend(submission_paths, id_col='id', target_col='target'):
    subs = [pd.read_csv(p).sort_values(id_col).reset_index(drop=True)
            for p in submission_paths]

    combined = pd.DataFrame({id_col: subs[0][id_col]})
    for i, s in enumerate(subs):
        combined[f'pred_{i}'] = s[target_col].values

    pred_cols = [c for c in combined.columns if c.startswith('pred_')]
    combined[target_col] = (combined[pred_cols]
        .mode(axis=1)[0].astype(int))

    return combined[[id_col, target_col]]

final = majority_vote_blend([
    'sub_lgbm.csv', 'sub_xgb.csv', 'sub_catboost.csv'
])
final.to_csv('submission.csv', index=False)
```

## Workflow

1. Generate N submission CSVs from independent model pipelines
2. Load all submissions and align rows by ID
3. Compute row-wise `mode()` across predictions
4. If tie (even number of models), `mode()[0]` takes the lowest class — add a tiebreaker model to avoid this

## Key Decisions

- **Odd number of models**: use 3, 5, or 7 pipelines to avoid ties
- **When to use**: discrete outputs only; for continuous predictions use rank averaging instead
- **Diversity matters**: majority voting gains nothing from correlated models — vary architecture, features, or seeds
- **Weighted variant**: `pd.Series([preds]).value_counts()` with weights for unequal-quality models

## References

- [LB0.494 with TabNet](https://www.kaggle.com/code/ichigoe/lb0-494-with-tabnet)
- [CMI | Tuning | Ensemble of solutions](https://www.kaggle.com/code/batprem/cmi-tuning-ensemble-of-solutions)

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.