一键导入
timeseries-ratio-target-for-smape
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Memory-efficient Keras generator that streams sharded CSV files in chunks, renders strokes to images on-the-fly, and yields batches for training on datasets too large for memory
Stack 1D convolutions for local feature extraction before bidirectional LSTMs to classify variable-length stroke sequences into hundreds of doodle categories
Partition a large dataset into N balanced shards using integer key modulo arithmetic for reproducible, class-interleaved splits across CSV files
Normalize raw stroke coordinates to 0-255 range, resample at uniform arc-length spacing, then apply Ramer-Douglas-Peucker simplification
Render stroke sequences to grayscale images with temporal intensity encoding where earlier strokes are brighter and later strokes fade to encode drawing order
Score each face in a video as anomalous by computing L2 distance from the embedding centroid of all faces, then convert to probability via logistic function
| name | timeseries-ratio-target-for-smape |
| description | Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE |
When the evaluation metric is SMAPE, predicting absolute values penalizes errors asymmetrically. Transforming the target to y_{t+1}/y_t - 1 (the relative change) aligns standard regression losses with SMAPE's symmetric percentage nature. The model learns relative changes, then predictions are converted back via pred * last_known_value + last_known_value.
import pandas as pd
df = df.sort_values(["entity_id", "date"])
df["target_ratio"] = df.groupby("entity_id")["value"].transform(
lambda s: s.shift(-1) / s - 1
)
# Train model on target_ratio with standard MAE/MSE loss
# At inference:
last_known = df.groupby("entity_id")["value"].last()
df["prediction"] = last_known * (1 + predicted_ratio)
value_{t+1} / value_t - 1 as the training target