Skip to content
Back to skills

Row Wise Target Normalization

ASecurity

Normalizes each sample's multi-output target vector to zero mean and unit variance, removing per-sample scale differences before training.

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
testingpython

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill row-wise-target-normalization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Row Wise Target Normalization?

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

Security grade badge for Row Wise Target Normalization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-row-wise-target-normalization/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-row-wise-target-normalization)

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-row-wise-target-normalization
description: >
  Normalizes each sample's multi-output target vector to zero mean and unit variance, removing per-sample scale differences before training.
---
# Row-wise Target Normalization

## Overview

In multi-output regression (e.g., predicting 140 protein levels per cell), each sample's target vector can have a different overall magnitude and offset. Row-wise normalization (subtract row mean, divide by row std) removes these per-sample differences, letting the model focus on relative patterns across outputs. This is critical when the evaluation metric is row-wise Pearson correlation, which is inherently scale- and offset-invariant — training on unnormalized targets wastes capacity learning per-sample baselines.

## Quick Start

```python
import numpy as np

# Y shape: (n_samples, n_targets)
row_mean = Y.mean(axis=1, keepdims=True)
row_std = Y.std(axis=1, keepdims=True)
Y_norm = (Y - row_mean) / (row_std + 1e-8)

# Train model on normalized targets
model.fit(X_train, Y_norm)

# At inference — no denormalization needed if metric is correlation
preds = model.predict(X_test)
```

## Workflow

1. Compute per-row mean and std across all target columns
2. Subtract mean and divide by std for each row
3. Train model on normalized targets
4. At inference, predict directly — no inverse transform needed for correlation metrics

## Key Decisions

- **When to apply**: When metric is correlation-based (Pearson, Spearman) or cosine similarity
- **Epsilon**: Add 1e-8 to std to avoid division by zero for constant rows
- **Denormalization**: Only needed if metric is MSE/MAE — store row_mean and row_std from training
- **vs column normalization**: Column-wise (StandardScaler) normalizes features; row-wise normalizes the target profile shape

## References

- [All in one: CITEseq & Multiome with Keras](https://www.kaggle.com/code/pourchot/all-in-one-citeseq-multiome-with-keras)

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.