skills/nlp/bidirectional-translation-augmentation/SKILL.md
Double training data by adding reverse-direction translation pairs with task prefix prompts
npx skillsauth add wenmin-wu/ds-skills nlp-bidirectional-translation-augmentationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
For low-resource translation, double the training data by adding reverse-direction pairs (A→B becomes both A→B and B→A). Uses task-prefix prompts so the model learns both directions in a single model. Especially effective when parallel data is scarce.
import pandas as pd
from datasets import Dataset
def make_bidirectional(df, src_col, tgt_col, src_lang, tgt_lang):
fwd = df.copy()
fwd['input_text'] = f"translate {src_lang} to {tgt_lang}: " + fwd[src_col].astype(str)
fwd['target_text'] = fwd[tgt_col].astype(str)
bwd = df.copy()
bwd['input_text'] = f"translate {tgt_lang} to {src_lang}: " + bwd[tgt_col].astype(str)
bwd['target_text'] = bwd[src_col].astype(str)
combined = pd.concat([fwd, bwd], ignore_index=True)
return Dataset.from_pandas(combined.sample(frac=1, random_state=42))
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF