Cv Exam Level Label Hierarchy Aggregation logo

Cv Exam Level Label Hierarchy Aggregation

Community
wenmin-wu
cv-exam-level-label-hierarchy-aggregation

Aggregate per-slice predictions into exam-level labels that satisfy a competition's mutual-exclusion hierarchy (positive vs negative vs indeterminate), using a top-down rule cascade — first decide the exam class, then conditionally rescale the dependent labels so the submission stays internally consistent

Overview

Publisherwenmin-wu
Repositoryds-skills
Skill namecv-exam-level-label-hierarchy-aggregation
Stars
63
Forks
4
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by wenmin-wu on GitHub. Read the source before you install it.

Installation

Install the Cv Exam Level Label Hierarchy Aggregation AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/wenmin-wu/ds-skills/tree/main/skills/cv/exam-level-label-hierarchy-aggregation
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wenmin-wu/ds-skills.git /tmp/ds-skills
mkdir -p .claude/skills
cp -r /tmp/ds-skills/skills/cv/exam-level-label-hierarchy-aggregation .claude/skills/cv-exam-level-label-hierarchy-aggregation
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cv Exam Level Label Hierarchy Aggregation in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cv Exam Level Label Hierarchy Aggregation on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cv Exam Level Label Hierarchy Aggregation is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Overview

Multi-label medical competitions usually impose constraints across labels: a study is negative_for_pe XOR indeterminate XOR positive_for_pe, and per-organ severity labels are only meaningful when the parent label is positive. Per-slice CNNs don't know about these rules and emit independent sigmoid scores that often violate them — negative_exam=0.7 and positive_exam=0.6 is contradictory and metric-penalized. The aggregation fix is a top-down cascade: first commit to the exam-level decision based on the strongest evidence (any slice above 0.5 → positive), then rescale the dependent labels conditionally — push winning labels up by 0.5 + score/2, push losing labels down by score/2. The final submission satisfies the hierarchy by construction.

Quick Start

python
import numpy as np
import pandas as pd
from scipy.special import softmax

def aggregate_exam(preds, exam_id):
    rows = preds.loc[preds.StudyInstanceUID == exam_id]
    is_positive = (rows.pe_present_on_image >= 0.5).any()

    out = {}
    if is_positive:
        out['negative_exam_for_pe'] = 0
        out['indeterminate']        = rows.indeterminate.min() / 2
    else:
        out['negative_exam_for_pe'] = 1
        if (rows.indeterminate >= 0.5).any():
            out['indeterminate'] = rows.indeterminate.max()
        else:
            out['indeterminate'] = rows.indeterminate.min() / 2

    a, b = rows[['rv_lv_ratio_gte_1', 'rv_lv_ratio_lt_1']].mean().values
    if a > b:
        a, b = a * 2, b / 2
    out['rv_lv_ratio_gte_1'], out['rv_lv_ratio_lt_1'] = softmax([a, b])

    for k in ['leftsided_pe', 'rightsided_pe', 'central_pe']:
        s = rows[k].mean()
        out[k] = (0.5 + s / 2) if is_positive else (s / 2)
    return out

Workflow

  1. Group per-slice predictions by exam id (StudyInstanceUID or analogous)
  2. Decide the top-level exam class from the strongest evidence — (slice_score >= 0.5).any() is the standard rule
  3. Set mutually exclusive top-level labels deterministically based on the decision
  4. For dependent labels (severity, location, etc.), rescale by 0.5 + mean/2 if the parent was positive, mean/2 if negative — this guarantees they stay below 0.5 in the negative case
  5. For paired labels that must softmax to 1.0 (e.g. rv_lv_ratio_gte_1 vs lt_1), apply softmax to the per-exam means after asymmetric pre-amplification of the winner

Key Decisions

  • Top-down decision first, then rescale: bottom-up averaging never satisfies the hierarchy.
  • 0.5 + score/2 and score/2 rescaling: pushes confident losers below 0.5 and confident winners above 0.5 without losing fine-grained ranking inside each side.
  • .any() for positive detection, not .mean(): a single confident positive slice should flip the exam — averaging dilutes it.
  • Asymmetric softmax pre-amplification: doubling the winner before softmax sharpens the output distribution without distorting the ranking.
  • Persist the rule cascade with the model: if the metric definition changes, you only update one function.

References

Frequently asked questions

What does the Cv Exam Level Label Hierarchy Aggregation AI skill do?

Aggregate per-slice predictions into exam-level labels that satisfy a competition's mutual-exclusion hierarchy (positive vs negative vs indeterminate), using a top-down rule cascade — first decide the exam class, then conditionally rescale the dependent labels so the submission stays internally consistent

Why use Cv Exam Level Label Hierarchy Aggregation on TypingMind?

Because you install it once and use it with any model. Cv Exam Level Label Hierarchy Aggregation is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cv Exam Level Label Hierarchy Aggregation in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wenmin-wu/ds-skills/tree/main/skills/cv/exam-level-label-hierarchy-aggregation. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Cv Exam Level Label Hierarchy Aggregation?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cv Exam Level Label Hierarchy Aggregation?

As many as you like. As long as a model supports skills, you can use Cv Exam Level Label Hierarchy Aggregation with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cv Exam Level Label Hierarchy Aggregation AI skill free?

It is published on GitHub by wenmin-wu. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇