Skip to content
Back to skills

Ranking Nce Estimator

ASecurity

Optimize finite ranking NCE objectives and recover conditional distributions when partition functions vary by input.

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
testingpythonbash

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill ranking_nce_estimator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ranking Nce Estimator?

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

Security grade badge for Ranking Nce Estimator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-ranking-nce-estimator/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-ranking-nce-estimator)

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: ranking_nce_estimator
description: Optimize finite ranking NCE objectives and recover conditional distributions when partition functions vary by input.
---

# Ranking NCE Estimator

Use this skill when a recovery needs the ranking objective from conditional NCE. It computes the paper's candidate-set objective and can optimize a small finite protocol without relying on an original implementation repository.

Do not use this skill for binary data-vs-noise NCE; use `binary_nce_estimator` for that objective.

## Inputs

- A `ConditionalNCEProtocol` from `conditional_nce_protocol`.
- A score function or the built-in Section 4.3 two-parameter score.
- Candidate events from exact enumeration or sampled data.
- Bounded optimizer settings.

## Outputs

- Ranking objective value.
- Estimated conditionals after score normalization over labels.
- Optimizer trace with parameters, loss values, and ratio diagnostics.
- Candidate posterior normalization checks.

## Workflow

1. Compute adjusted scores `bar_s=s-log p_N`.
2. For each event, form a `(K+1)`-way softmax over the positive candidate and all negative candidates.
3. Accumulate the expected log probability of the positive candidate.
4. Normalize scores over the complete label set to produce `p_hat(y|x)`.
5. In reduced recovery, optimize the Section 4.3 population objective and verify the `x1` ratio approaches `1/3`.

## Validation

Run:

```bash
python /share/project/yuyang/workspace/Paper2Skills/Distiller/skills/module-to-skill/scripts/validate_skill_tree.py . --run-tests
```

The tests check objective finiteness, softmax normalization, and recovery of the Section 4.3 ratio.

## Limitations

The included optimizer is designed for deterministic small-support recovery. Large neural language-model training should use a real ML stack and treat this skill as a semantic reference for the objective.

Files in this skill

  • SKILL.md1.8 KB
  • scripts/ranking_nce.py5 KB
  • tests/test_ranking_nce.py1.3 KB

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.