wenmin-wu/ds-skills/authorized-flag-table-split

Claude Code and agent skill by wenmin-wu/ds-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Split a transaction table by a binary status flag (authorized vs. declined, paid vs. refunded) into two parallel sub-tables, then build the same aggregate feature pipeline on each — the declined-transaction features are usually as predictive as the authorized ones because they encode risk and friction the authorized stream alone hides

Install

npx vskill@latest install wenmin-wu/ds-skills/authorized-flag-table-split

SKILL.md

Overview

A common mistake on transaction panels is to filter authorized_flag == 'Y' and discard the rest. The declined rows are not noise — they encode declined-rate, declined-amount, declined-merchant-diversity, and other friction signals that strongly correlate with churn, fraud, and loyalty score. Top Elo Merchant solutions all built three parallel feature blocks: (1) full table, (2) authorized-only sub-table, (3) non-authorized sub-table — each through the same groupby(card_id).agg(...) pipeline. The model learns from the contrast: auth_amt_mean / nonauth_amt_mean, auth_count / total_count. Generalize to any binary flag — paid/refunded, success/failure, mobile/web.

Quick Start

python
auth = tx[tx.authorized_flag == 'Y']
nonauth = tx[tx.authorized_flag == 'N']
def agg_block(df, prefix):
g = df.groupby('card_id').agg(
amt_sum=('purchase_amount', 'sum'),
amt_mean=('purchase_amount', 'mean'),
cnt=('purchase_amount', 'size'),
nuniq_merch=('merchant_id', 'nunique'),
).reset_index()
g.columns = ['card_id'] + [f'{prefix}_{c}' for c in g.columns[1:]]
return g
feat_all = agg_block(tx, 'all')
feat_auth = agg_block(auth, 'auth')
feat_non = agg_block(nonauth, 'nonauth')
cards = feat_all.merge(feat_auth, on='card_id', how='left')\
.merge(feat_non, on='card_id', how='left')
cards['auth_rate'] = cards['auth_cnt'] / cards['all_cnt']

Workflow

  1. Identify the binary flag (authorized_flag, paid, is_success)
  2. Split the transaction frame into two sub-frames — keep both, do not filter and forget
  3. Run the same aggregate pipeline (sum/mean/count/nunique/std) on each sub-frame, plus the union
  4. Suffix column names (auth_*, nonauth_*) so feature importance is self-explanatory
  5. Hand-craft 2-3 ratio features post-merge (auth_rate, auth_amt_share)
  6. Left-merge all three blocks onto the entity table; fill NaN with 0 only when 0 is semantically zero (e.g., count), not for means

Key Decisions

  • Three blocks not two: the union block is not redundant — it gives the model an unconditional baseline that the splits are deviations from.
  • Ratio features are critical: auth_rate (declined fraction) is usually a top-10 feature on its own.
  • Fill strategy matters: counts → 0; means/stds → leave NaN so LightGBM can split on missingness directly.
  • Generalizes beyond yes/no: any low-cardinality status column (3-5 values) can be split this way; cardinality > 10 is too many parallel blocks.
  • Don't double-count in the union: the union features come from tx, not pd.concat([auth, nonauth]) — they are identical but the latter is slower.

References

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/wenmin-wu/ds-skills/authorized-flag-table-split/badge)](https://verified-skill.com/skills/wenmin-wu/ds-skills/authorized-flag-table-split)

Something wrong with this skill or its page? Tell us.