一键导入
timeseries-kaggle-api-streaming-inference
Predict day-by-day via Kaggle's iter_test API while maintaining a rolling history buffer for computing lag features online
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Predict day-by-day via Kaggle's iter_test API while maintaining a rolling history buffer for computing lag features online
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
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
基于 SOC 职业分类
| name | timeseries-kaggle-api-streaming-inference |
| description | Predict day-by-day via Kaggle's iter_test API while maintaining a rolling history buffer for computing lag features online |
Kaggle time-series competitions often use a streaming API where test data arrives one day at a time. The model must predict using only data available up to that point. This requires maintaining a rolling history buffer, computing lag features on the fly, and appending each day's predictions back to the buffer for use as future lag inputs.
import pandas as pd
from datetime import timedelta
history = train_df[["entity_id", "date"] + TARGETS].copy()
env = competition.make_env()
for test_df, sample_sub in env.iter_test():
eval_date = pd.to_datetime(test_df["date"].iloc[0])
# Compute lag features from history
lag_features = []
for lag in range(1, 21):
lag_date = eval_date - timedelta(days=lag)
lag_vals = history[history["date"] == lag_date][["entity_id"] + TARGETS]
lag_vals = lag_vals.rename(columns={t: f"{t}_{lag}" for t in TARGETS})
lag_features.append(lag_vals)
features = test_df[["entity_id"]].copy()
for lf in lag_features:
features = features.merge(lf, on="entity_id", how="left")
features = features.fillna(0)
preds = model.predict(features[lag_cols])
sample_sub[TARGETS] = preds
# Update history with today's predictions
new_row = test_df[["entity_id", "date"]].copy()
new_row[TARGETS] = preds
history = pd.concat([history, new_row], ignore_index=True)
env.predict(sample_sub)
iter_test():
a. Extract the evaluation date
b. Look up lag values from the history buffer
c. Construct the feature vector matching the training schema
d. Predict and submit
e. Append predictions to history for future lag computation