backup materials and knowledge-base docs

This commit is contained in:
admin
2026-05-30 16:22:29 +08:00
commit 93e50e8fce
3024 changed files with 2994945 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
---
name: kaggle-learner
description: This skill should be used when the user asks to "learn from Kaggle", "study Kaggle solutions", "analyze Kaggle competitions", or mentions Kaggle competition URLs. Provides access to extracted knowledge from winning Kaggle solutions across NLP, CV, time series, tabular, and multimodal domains.
version: 0.1.0
---
# Kaggle Learner
Extract and apply knowledge from Kaggle competition winning solutions. This skill provides access to a continuously updated knowledge base of techniques, code patterns, and best practices from top Kaggle competitors.
## Overview
Kaggle competitions are at the forefront of practical machine learning. Winning solutions often innovate with novel techniques, clever feature engineering, and optimized pipelines. This skill captures that knowledge and makes it accessible for your projects.
## When to Use
Use this skill when:
- Studying for a Kaggle competition
- Looking for proven techniques in a specific domain (NLP, CV, etc.)
- Need code templates for common ML tasks
- Want to learn from competition winners
## Knowledge Categories
| Category | Focus | Directory |
|----------|-------|-----------|
| **NLP** | Text classification, NER, translation, LLM applications | `references/knowledge/nlp/` |
| **CV** | Image classification, detection, segmentation, generation | `references/knowledge/cv/` |
| **Time Series** | Forecasting, anomaly detection, sequence modeling | `references/knowledge/time-series/` |
| **Tabular** | Feature engineering, traditional ML, structured data | `references/knowledge/tabular/` |
| **Multimodal** | Cross-modal tasks, vision-language models | `references/knowledge/multimodal/` |
**文件组织结构**:每个竞赛一个独立的 markdown 文件,按 domain 分类到对应目录。
示例:
- `time-series/birdclef-plus-2025.md`
- `nlp/aimo-2-2025.md`
## Quick Reference
**To learn from a competition:**
1. Provide the Kaggle competition URL
2. The kaggle-miner agent will extract the winning solution
3. Knowledge is automatically added to the relevant category
4. **前排方案详细技术分析** (Front-runner Detailed Technical Analysis) is automatically included
**To browse existing knowledge:**
- 浏览相关 domain 目录:`references/knowledge/[domain]/`
- 每个竞赛一个独立文件,包含:
- Competition Brief (竞赛简介)
- **前排方案详细技术分析** (前排方案详细技术分析) ⭐
- Code Templates (代码模板)
- Best Practices (最佳实践)
## Self-Evolving
This skill automatically updates its knowledge base when the kaggle-miner agent processes new competitions. The more you use it, the smarter it becomes.
## Knowledge Extraction Standard
每次从 Kaggle 竞赛提取知识时,**必须**包含以下标准部分:
### 必需内容清单
| 部分 | 说明 | 必需性 |
|------|------|--------|
| **Competition Brief** | 竞赛背景、任务描述、数据规模、评估指标 | ✅ 必需 |
| **Original Summaries** | 前排方案的简要概述 | ✅ 必需 |
| **前排方案详细技术分析** | Top 20 方案的核心技巧和实现细节 | ✅ **必需** ⭐ |
| **Code Templates** | 可复用的代码模板 | ✅ 必需 |
| **Best Practices** | 最佳实践和常见陷阱 | ✅ 必需 |
| **Metadata** | 数据源标签和日期 | ✅ 必需 |
### 前排方案详细技术分析格式
每个前排方案应包含:
- **排名和团队/作者**
- **核心技巧列表** (3-6 个关键技术点)
- **实现细节** (具体的参数、配置、数据)
示例格式:
```markdown
**排名 Place - 核心技术名称 (作者)**
核心技巧:
- **技巧1**: 简短说明
- **技巧2**: 简短说明
实现细节:
- 具体参数、模型、配置
- 数据和实验结果
```
**建议覆盖 Top 20 方案,获取更多前排选手的创新技巧**
## Additional Resources
### Knowledge Directories
- **`references/knowledge/nlp/`** - NLP competition techniques
- **`references/knowledge/cv/`** - Computer vision techniques
- **`references/knowledge/time-series/`** - Time series methods
- **`references/knowledge/tabular/`** - Tabular data approaches
- **`references/knowledge/multimodal/`** - Multimodal solutions
### Competition Examples
- **BirdCLEF+ 2025** (`time-series/birdclef-plus-2025.md`) - 包含完整的 Top 14 前排方案详细技术分析
- **BirdCLEF 2024** (`time-series/birdclef-2024.md`) - 包含 Top 3 方案详细技术分析
- **AIMO-2** (`nlp/aimo-2-2025.md`) - 包含 Top 12+ 前排方案技术总结

View File

@@ -0,0 +1,17 @@
# CV Knowledge Base
> Last updated: 2026-01-21
> Source count: 0
## Original Summaries
_No sources yet._
## Code Templates
_No templates yet._
## Best Practices
_No practices yet._
## Metadata
| Source | Date | Tags |
|--------|------|------|

View File

@@ -0,0 +1,17 @@
# Multimodal Knowledge Base
> Last updated: 2026-01-21
> Source count: 0
## Original Summaries
_No sources yet._
## Code Templates
_No templates yet._
## Best Practices
_No practices yet._
## Metadata
| Source | Date | Tags |
|--------|------|------|

View File

@@ -0,0 +1,829 @@
# Tabular Knowledge Base
> Last updated: 2025-01-22
> Source count: 1
## Original Summaries
### CMI - Problematic Internet Use (2024) - 2025-01-22
**Source:** [Kaggle Competition](https://www.kaggle.com/competitions/child-mind-institute-problematic-internet-use)
**Category:** Tabular (表格数据 + 时序混合)
**Key Techniques:**
- **中间分数预测**:预测 PCIAT-PCIAT_Total 而非直接预测 sii
- **多seed平均**减少seed引起的方差
- **高fold交叉验证**10-fold stratified KFold
- **Pseudo Labeling**填充缺失target
- **GBM主导的集成**LGBM + XGBoost + CatBoost
- **Tweedie Loss**:处理偏态分布
- **时序特征工程**k-means聚类
- **特征清洗**去除异常特征、PCA降维
**Results:** 多seed平均、预测中间分数、Pseudo Labeling 是关键技术
---
## Competition Brief (竞赛简介)
### CMI - Problematic Internet Use (2024)
**竞赛背景:**
- **主办方**Child Mind Institute
- **目标**预测儿童和青少年的问题性网络使用严重程度sii
- **应用场景**:理解与抑郁和焦虑等心理健康问题相关的网络使用行为
**数据集规模:**
- 总样本数:约 3,900+(训练集)
- 特征:表格数据 + 部分时序数据
- 类别4 分类sii = 0, 1, 2, 3
**数据特点:**
1. **混合数据类型**:表格数据(身体活动、健康指标)+ 时序数据
2. **target 缺失**:训练集中部分样本的 sii 缺失
3. **中间分数**PCIAT-PCIAT_Total 是 sii 的连续分数版本
4. **类别分布不均**:约 58.3% 为 0 类(无问题)
**评估指标:**
- **Quadratic Weighted Kappa (QWK)**:衡量预测与实际的一致性
- 分数范围:-1 到 1越高越好
- 特点:对分类错误的惩罚与严重程度成正比
**关键挑战:**
1. **Seed 敏感**:不同 seed 导致 LB 分数剧烈波动
2. **数据泄露**:公开 notebook 泄露了训练数据
3. **LB 不可靠**Private LB 大幅 shake波动
4. **Target 缺失**:需要 Pseudo Labeling 处理
---
## Code Templates
### 中间分数预测 (PCIAT-PCIAT_Total)
**关键洞察:** 预测连续分数比直接预测类别更有效
```python
import numpy as np
import pandas as pd
from lightgbm import LGBMRegressor
from sklearn.model_selection import StratifiedKFold
# 原始 sii 标签: 0, 1, 2, 3
# PCIAT-PCIAT_Total: 连续分数 (0-100)
def train_intermediate_target_model(X_train, y_train_total, X_test):
"""
预测 PCIAT-PCIAT_Total (中间分数),然后转换为 sii
"""
# 根据 sii 创建分层的 bins
# 这确保每个 fold 中各类别比例一致
train_df = X_train.copy()
train_df['sii'] = (y_train_total > 30).astype(int) + \
(y_train_total > 50).astype(int) + \
(y_train_total > 80).astype(int)
# 10-fold stratified KFold
n_folds = 10
skf = StratifiedKFold(n_splits=n_folds, shuffle=True, random_state=42)
# 存储预测结果
oof_preds = np.zeros(len(X_train))
test_preds = np.zeros(len(X_test))
for fold, (train_idx, val_idx) in enumerate(skf.split(X_train, train_df['sii'])):
X_tr, X_val = X_train.iloc[train_idx], X_train.iloc[val_idx]
y_tr, y_val = y_train_total.iloc[train_idx], y_train_total.iloc[val_idx]
# LightGBM 回归器
model = LGBMRegressor(
n_estimators=1000,
learning_rate=0.05,
num_leaves=31,
max_depth=-1,
random_state=42 + fold # 每个 fold 不同 seed
)
model.fit(X_tr, y_tr, eval_set=[(X_val, y_val)],
early_stopping_rounds=100, verbose=False)
# 预测中间分数
oof_preds[val_idx] = model.predict(X_val)
test_preds += model.predict(X_test) / n_folds
return oof_preds, test_preds
def convert_total_to_sii(pred_total):
"""
将 PCIAT-PCIAT_Total 转换为 sii 标签
阈值: 0-30→0, 31-50→1, 51-80→2, 81-100→3
"""
pred_sii = np.zeros(len(pred_total))
pred_sii[pred_total > 30] = 1
pred_sii[pred_total > 50] = 2
pred_sii[pred_total > 80] = 3
return pred_sii.astype(int)
```
### 多 Seed 平均
**关键洞察:** 多个 seed 平均可以减少预测方差
```python
import numpy as np
from lightgbm import LGBMRegressor
def multi_seed_prediction(X_train, y_train, X_test, seeds=[42, 123, 456, 789, 1011]):
"""
多个 seed 训练模型,取平均预测
"""
test_preds_all = []
for seed in seeds:
model = LGBMRegressor(
n_estimators=1000,
learning_rate=0.05,
random_state=seed
)
model.fit(X_train, y_train)
test_preds_all.append(model.predict(X_test))
# 平均预测
test_preds_mean = np.mean(test_preds_all, axis=0)
return test_preds_mean
# 更进一步:多 fold × 多 seed
def multi_fold_multi_seed(X_train, y_train, X_test, n_folds=5, seeds=10):
"""
多 fold × 多 seed = 更稳定的预测
"""
n_folds = 5
seeds = list(range(10)) # 10 个 seeds
test_preds = []
for seed in seeds:
for fold in range(n_folds):
model = LGBMRegressor(
n_estimators=1000,
random_state=seed + fold * 100
)
# ... train and predict
test_preds.append(model.predict(X_test))
# 50 个模型的平均 (5 folds × 10 seeds)
return np.mean(test_preds, axis=0)
```
### Pseudo Labeling
**关键洞察:** 用模型预测填充缺失的 target
```python
import numpy as np
import pandas as pd
def pseudo_labeling(X_train, y_train, X_missing, n_iterations=3):
"""
Pseudo Labeling 迭代填充缺失 target
"""
# 分割有标签和无标签数据
has_label = ~y_train.isna()
X_labeled = X_train[has_label]
y_labeled = y_train[has_label]
X_unlabeled = X_train[~has_label]
# 初始模型(仅用有标签数据训练)
model = LGBMRegressor(random_state=42)
model.fit(X_labeled, y_labeled)
# 迭代预测和训练
for iteration in range(n_iterations):
# 预测无标签数据
pseudo_labels = model.predict(X_unlabeled)
# 合并有标签和伪标签数据
X_combined = pd.concat([X_labeled, X_unlabeled])
y_combined = pd.concat([y_labeled, pd.Series(pseudo_labels, index=X_unlabeled.index)])
# 重新训练模型
model = LGBMRegressor(random_state=42 + iteration)
model.fit(X_combined, y_combined)
return model
# 注意CV 计算时不使用 pseudo labels
def cv_with_pseudo(X_train, y_train, X_missing):
"""
交叉验证时不使用 pseudo labels
"""
has_label = ~y_train.isna()
X_labeled = X_train[has_label]
y_labeled = y_train[has_label]
# 训练 pseudo 模型(用于最终预测)
pseudo_model = pseudo_labeling(X_train, y_train, X_missing)
# CV 仅用有标签数据
from sklearn.model_selection import cross_val_score
cv_model = LGBMRegressor(random_state=42)
cv_scores = cross_val_score(cv_model, X_labeled, y_labeled, cv=5)
return pseudo_model, cv_scores
```
### Tweedie Loss
**关键洞察:** 处理偏态分布的目标变量
```python
import lightgbm as lgb
def train_with_tweedie_loss(X_train, y_train, X_val, y_val):
"""
使用 Tweedie Loss 训练 LightGBM
适用于偏态分布(如保险索赔、疾病严重程度)
"""
train_data = lgb.Dataset(X_train, label=y_train)
val_data = lgb.Dataset(X_val, label=y_val, reference=train_data)
params = {
'objective': 'tweedie',
'tweedie_variance_power': 1.5, # 1 < p < 2控制偏态程度
'metric': 'rmse',
'learning_rate': 0.05,
'num_leaves': 31,
'max_depth': -1,
'verbose': -1
}
model = lgb.train(
params,
train_data,
num_boost_round=1000,
valid_sets=[val_data],
early_stopping_rounds=100,
verbose_eval=False
)
return model
```
### 时序特征 k-means 聚类
**关键洞察:** 将时序数据聚类成类别特征
```python
import numpy as np
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
def extract_time_series_cluster_features(time_series_data, n_clusters=5):
"""
时序数据 k-means 聚类作为特征
"""
# 假设 time_series_data 是 (n_samples, n_timesteps, n_features)
n_samples = time_series_data.shape[0]
# 展平时序数据: (n_samples, n_timesteps * n_features)
ts_flat = time_series_data.reshape(n_samples, -1)
# 标准化
scaler = StandardScaler()
ts_scaled = scaler.fit_transform(ts_flat)
# k-means 聚类
kmeans = KMeans(n_clusters=n_clusters, random_state=42, n_init=10)
cluster_labels = kmeans.fit_predict(ts_scaled)
# 聚类距离作为特征
cluster_distances = kmeans.transform(ts_scaled)
# 创建特征 DataFrame
cluster_features = pd.DataFrame({
f'ts_cluster_dist_{i}': cluster_distances[:, i]
for i in range(n_clusters)
})
cluster_features['ts_cluster_label'] = cluster_labels
return cluster_features
# 使用示例
# time_series_data 是原始时序数据
# cluster_features = extract_time_series_cluster_features(time_series_data)
# X_final = pd.concat([tabular_features, cluster_features], axis=1)
```
### 特征清洗和 PCA 降维
**关键洞察:** 去除异常特征PCA 降维减少噪声
```python
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
def clean_features(X, threshold=0.99):
"""
清洗异常特征
- 去除高度相关的特征
- 去除方差过小的特征
"""
# 计算相关性矩阵
corr_matrix = X.corr().abs()
# 找到高度相关的特征对
upper_tri = corr_matrix.where(
np.triu(np.ones(corr_matrix.shape), k=1).astype(bool)
)
# 找出相关性 > threshold 的特征
to_drop = [column for column in upper_tri.columns if any(upper_tri[column] > threshold)]
# 去除高度相关的特征
X_cleaned = X.drop(columns=to_drop)
return X_cleaned, to_drop
def pca_reduction(X_train, X_test, variance_ratio=0.95):
"""
PCA 降维
"""
# 标准化
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)
# PCA
pca = PCA(n_components=variance_ratio)
X_train_pca = pca.fit_transform(X_train_scaled)
X_test_pca = pca.transform(X_test_scaled)
print(f"Original features: {X_train.shape[1]}")
print(f"PCA components: {X_train_pca.shape[1]}")
print(f"Variance explained: {pca.explained_variance_ratio_.sum():.4f}")
return X_train_pca, X_test_pca, pca
```
### GBM Ensemble (LGBM + XGBoost + CatBoost)
**关键洞察:** 不同 GBM 的集成提升稳定性
```python
import numpy as np
from lightgbm import LGBMRegressor
from xgboost import XGBRegressor
from catboost import CatBoostRegressor
def train_gbm_ensemble(X_train, y_train, X_test):
"""
训练 GBM 集成: LGBM + XGBoost + CatBoost
"""
models = []
test_preds = []
# 1. LightGBM
lgbm = LGBMRegressor(
n_estimators=1000,
learning_rate=0.05,
num_leaves=31,
max_depth=-1,
random_state=42,
verbose=-1
)
lgbm.fit(X_train, y_train)
models.append(lgbm)
test_preds.append(lgbm.predict(X_test))
# 2. XGBoost
xgb = XGBRegressor(
n_estimators=1000,
learning_rate=0.05,
max_depth=6,
random_state=42,
verbosity=0
)
xgb.fit(X_train, y_train)
models.append(xgb)
test_preds.append(xgb.predict(X_test))
# 3. CatBoost
cat = CatBoostRegressor(
iterations=1000,
learning_rate=0.05,
depth=6,
random_state=42,
verbose=False
)
cat.fit(X_train, y_train)
models.append(cat)
test_preds.append(cat.predict(X_test))
# 简单平均
ensemble_pred = np.mean(test_preds, axis=0)
return models, ensemble_pred
# 带权重的集成
def weighted_gbm_ensemble(X_train, y_train, X_test, weights=[0.4, 0.3, 0.3]):
"""
带权重的 GBM 集成
weights: [lgbm, xgb, cat]
"""
lgbm = LGBMRegressor(random_state=42, verbose=-1).fit(X_train, y_train)
xgb = XGBRegressor(random_state=42, verbosity=0).fit(X_train, y_train)
cat = CatBoostRegressor(random_state=42, verbose=False).fit(X_train, y_train)
pred_lgbm = lgbm.predict(X_test)
pred_xgb = xgb.predict(X_test)
pred_cat = cat.predict(X_test)
# 加权平均
ensemble_pred = (
weights[0] * pred_lgbm +
weights[1] * pred_xgb +
weights[2] * pred_cat
)
return ensemble_pred
```
### 数据增强(随机 NaN + 高斯噪声)
**关键洞察:** 添加噪声提高模型鲁棒性
```python
import numpy as np
def augment_data_with_noise(X_train, y_train, n_augmented=2, nan_ratio=0.1, noise_std=0.01):
"""
数据增强:随机插入 NaN + 添加高斯噪声
"""
X_aug_list = [X_train.copy()]
y_aug_list = [y_train.copy()]
for _ in range(n_augmented):
X_aug = X_train.copy()
# 1. 随机插入 NaN
mask = np.random.random(X_aug.shape) < nan_ratio
X_aug[mask] = np.nan
# 2. 添加高斯噪声
noise = np.random.normal(0, noise_std, X_aug.shape)
X_aug = X_aug + noise
X_aug_list.append(X_aug)
y_aug_list.append(y_train.copy())
# 合并原始数据和增强数据
X_final = pd.concat(X_aug_list, axis=0, ignore_index=True)
y_final = pd.concat(y_aug_list, axis=0, ignore_index=True)
return X_final, y_final
# 使用示例(需要支持 NaN 处理的模型)
# X_aug, y_aug = augment_data_with_noise(X_train, y_train)
# model = LGBMRegressor().fit(X_aug, y_aug)
```
### 阈值优化CGAS=80, SDS=35
**关键洞察:** 特定健康分数的阈值可预测严重问题
```python
import numpy as np
from scipy.optimize import minimize
def optimize_thresholds(y_true, y_pred_total):
"""
优化将 PCIAT-PCIAT_Total 转换为 sii 的阈值
默认阈值: [30, 50, 80]
"""
def qwk_loss(thresholds):
t1, t2, t3 = thresholds
pred_sii = np.zeros(len(y_pred_total))
pred_sii[y_pred_total > t1] = 1
pred_sii[y_pred_total > t2] = 2
pred_sii[y_pred_total > t3] = 3
# 计算 QWK简化版本
from sklearn.metrics import cohen_kappa_score
kappa = cohen_kappa_score(y_true, pred_sii, weights='quadratic')
return -kappa # 最小化负 QWK
# 初始阈值
x0 = [30, 50, 80]
# 优化(确保 t1 < t2 < t3
bounds = [(0, 40), (40, 60), (60, 100)]
constraints = {'type': 'ineq', 'fun': lambda x: x[1] - x[0]}
result = minimize(qwk_loss, x0, bounds=bounds, constraints=constraints)
optimal_thresholds = result.x
print(f"Optimal thresholds: {optimal_thresholds}")
return optimal_thresholds
# 特定阈值的使用4th Place 发现)
def apply_specific_thresholds(pred_total):
"""
使用特定健康分数阈值
CGAS=80, SDS=35 可预测严重问题
"""
pred_sii = np.zeros(len(pred_total))
# 默认阈值
pred_sii[pred_total > 30] = 1
pred_sii[pred_total > 50] = 2
pred_sii[pred_total > 80] = 3
# 特殊情况:如果有 CGAS 或 SDS 数据,结合判断
# 这需要原始数据中的这些特征
# if has_cgas_data and cgas_score > 80:
# pred_sii = 3
return pred_sii.astype(int)
```
---
## Best Practices
### 表格数据竞赛策略
| 策略 | 何时使用 | 说明 |
|------|---------|------|
| **预测中间分数** | 有连续分数和类别标签时 | 预测 PCIAT-PCIAT_Total 比直接预测 sii 更有效 |
| **多 Seed 平均** | Seed 导致结果波动大时 | 多个 seed 训练,取平均减少方差 |
| **高 Fold CV** | 数据量较小或类别不平衡时 | 10-fold stratified KFold 稳定验证 |
| **Pseudo Labeling** | Target 有缺失时 | 用模型预测填充缺失 target |
| **GBM Ensemble** | 单模型不够稳定时 | LGBM + XGBoost + CatBoost 集成 |
| **Tweedie Loss** | 目标变量偏态分布时 | 处理保险、疾病严重程度等偏态数据 |
| **时序聚类特征** | 有时序数据时 | k-means 聚类将时序转为类别特征 |
| **特征清洗** | 特征过多或有噪声时 | 去除高度相关特征PCA 降维 |
### QWK 评估指标的优化
**Quadratic Weighted Kappa (QWK)**
- 衡量预测与实际的一致性
- 分数范围:-1 到 1越高越好
- 特点:对严重错误的惩罚更重
**优化策略:**
| 策略 | 效果 |
|------|------|
| **预测中间分数** | 预测连续值比直接分类更精细 |
| **阈值优化** | 在验证集上优化转换阈值 |
| **分层 KFold** | 确保每个 fold 中类别比例一致 |
| **多 Seed 平均** | 减少 seed 引起的 QWK 波动 |
### 数据增强策略
**表格数据增强:**
| 方法 | 适用场景 | 注意事项 |
|------|---------|---------|
| **随机 NaN** | 提高缺失值鲁棒性 | 需要模型支持 NaN 处理 |
| **高斯噪声** | 提高模型泛化能力 | 噪声强度需调参 |
| **特征 Shuffle** | 特征独立性强时 | 破坏特征相关性时慎用 |
| **SMOTE** | 类别不平衡时 | 可能导致过拟合 |
### Target 缺失处理
**处理策略对比:**
| 策略 | 优点 | 缺点 |
|------|------|------|
| **删除缺失样本** | 简单直接 | 损失数据,减少样本量 |
| **Pseudo Labeling** | 利用无标签数据 | 可能引入噪声 |
| **两阶段训练** | Stage 1 用有标签Stage 2 用全部 | 需要精心设计 |
**推荐做法:**
```python
# 1. CV 计算时不使用 pseudo labels
# 2. 最终模型用 pseudo labels
# 3. 迭代多次,每次用上一轮的预测
```
### 模型选择指南
**表格数据竞赛模型选择:**
| 场景 | 推荐模型 | 理由 |
|------|---------|------|
| **表格数据(主要)** | LightGBM | 速度快,效果好 |
| **类别特征多** | CatBoost | 自动处理类别特征 |
| **需要调参灵活性** | XGBoost | 参数丰富,调参空间大 |
| **数据量大** | LightGBM | 内存效率高 |
| **集成** | LGBM + XGB + Cat | 多样性提升稳定性 |
**不推荐场景:**
- 神经网络:表格数据通常不如 GBM
- 深度学习:除非有特殊结构(如图嵌入)
---
## Top 10 Solutions Comparison (前 10 名方案对比分析)
> 基于前排解决方案的横向对比分析,提取共性技术和差异创新
### 前 5 名详细对比
#### 1st Place - Lennart Haupts
**核心架构:** GBM Ensemble (LGBM + XGBoost + CatBoost + ExtraTrees)
**关键技术:**
- **预测 PCIAT-PCIAT_Total**:预测中间分数而非直接预测 sii
- **10-Fold Stratified KFold**:高 fold 提升稳定性
- **特征清洗**:去除异常特征
- **PCA 降维**:减少特征噪声
**模型组合:**
```
LGBMRegressor
+ XGBoost Regressors
+ CatBoostRegressor
+ ExtraTreesRegressor
→ Ensemble (平均/加权)
```
#### 3rd Place
**核心架构:** LightGBM with Multi-Seed
**关键技术:**
- **Multi-Seed Training**seed 不固定5-fold 重复 100 次
- **Optuna 调参**:自动化超参数优化
- **数据增强**
- 随机插入 NaN
- 添加高斯噪声
- **特征工程**:多样化的特征变换
**训练策略:**
```python
for seed in range(100):
for fold in range(5):
model = LGBMRegressor(random_state=seed)
train_and_evaluate()
```
#### 5th Place
**核心架构:** Multi-Model Ensemble
**关键技术:**
- **时序特征工程**k-means 聚类将时序转为类别特征
- **Pseudo Labeling**:填充缺失 target
- **多模型集成**LGB + Cat + XGB + Lasso + NN
**模型组合:**
```
LGBM + CatBoost + XGBoost
+ Lasso (线性模型)
+ Neural Network
→ Ensemble
```
#### 7th Place
**核心架构:** LGBM + XGBoost Ensemble
**关键技术:**
- **Tweedie Loss**:处理偏态分布
- **Pseudo Labeling**:有效提升分数
- **缺失值处理**:用中位数填补
- **Multi-Seed Ensemble**10 个 seed 平均
#### 4th Place (underfit squad)
**核心发现:**
- **CGAS=80 阈值**CGAS 分数 > 80 可预测严重问题
- **SDS=35 阈值**SDS 分数 > 35 可预测严重问题
**关键技术:**
- TabNet效果不佳
- 预测 PCIAT-PCIAT_Total
- 特征工程CGAS, SDS 阈值
### 共性技术("银弹" - 高分者共同使用)
| 技术 | 使用排名 | 说明 |
|------|---------|------|
| **预测中间分数** | 1st, 3rd, 5th, 7th | 预测 PCIAT-PCIAT_Total 比直接预测 sii |
| **多 Seed 平均** | 3rd, 7th | 减少 seed 引起的方差 |
| **Pseudo Labeling** | 5th, 7th | 填充缺失 target |
| **GBM Ensemble** | 1st, 5th, 7th | LGBM + XGBoost + CatBoost |
| **高 Fold CV** | 1st | 10-fold stratified KFold |
| **特征清洗** | 1st | 去除异常特征PCA 降维 |
### 差异创新
**1st Place vs 其他:**
| 方面 | 1st Place | 其他 |
|------|-----------|------|
| **模型组合** | LGBM + XGB + Cat + ExtraTrees | 主要 3 个 GBM |
| **Fold 数量** | 10-fold | 5-fold 或更多 |
| **特征处理** | 严格清洗 + PCA | 较少使用 PCA |
**3rd Place vs 其他:**
| 方面 | 3rd Place | 其他 |
|------|-----------|------|
| **训练策略** | 5-fold × 100-seed | 单次训练或少 seed |
| **调参方法** | Optuna 自动调参 | 手动调参 |
| **数据增强** | 随机 NaN + 高斯噪声 | 较少数据增强 |
**5th Place vs 其他:**
| 方面 | 5th Place | 其他 |
|------|-----------|------|
| **时序处理** | k-means 聚类 | 较少特殊处理 |
| **模型多样性** | GBM + 线性 + NN | 主要是 GBM |
| **Pseudo Labeling** | 显著有效 | 效果不一 |
**7th Place vs 其他:**
| 方面 | 7th Place | 其他 |
|------|-----------|------|
| **Loss 函数** | Tweedie Loss | 主要是 MSE/MAE |
| **缺失值处理** | 中位数填补 | 其他方法 |
| **Ensemble 策略** | 10-seed 平均 | 少 seed 或不用 |
### Target 预测策略对比
| 排名 | 预测目标 | 理由 |
|------|---------|------|
| **1st** | PCIAT-PCIAT_Total | 连续值比类别更精细 |
| **3rd** | PCIAT-PCIAT_Total | 同左 |
| **5th** | PCIAT-PCIAT_Total | 同左 |
| **7th** | PCIAT-PCIAT_Total | 同左 |
**结论:** 所有前排方案都选择预测中间分数
### 特征工程对比
| 排名 | 特征工程策略 |
|------|-------------|
| **1st** | 清洗异常特征 + PCA 降维 |
| **3rd** | 随机 NaN + 高斯噪声 |
| **5th** | 时序 k-means 聚类 |
| **7th** | 中位数填补缺失值 |
### 数据增强对比
| 排名 | 数据增强策略 |
|------|-------------|
| **1st** | 较少数据增强 |
| **3rd** | 随机 NaN + 高斯噪声 |
| **5th** | Pseudo Labeling |
| **7th** | Multi-Seed 平均 |
### Pseudo Labeling 对比
| 排名 | 是否使用 | 效果 |
|------|---------|------|
| **1st** | 未提及 | - |
| **3rd** | 未提及 | - |
| **5th** | 使用 | 显著有效 |
| **7th** | 使用 | 显著有效 |
**结论:** Pseudo Labeling 在 5th 和 7th 有效,可能需要正确实现
### 关键数据洞察总结
1. **预测中间分数是关键**:所有前排方案都预测 PCIAT-PCIAT_Total
2. **多 Seed 平均有效**:减少 seed 引起的方差
3. **Pseudo Labeling 需要正确实现**5th 和 7th 报告有效
4. **GBM Ensemble 是主流**LGBM + XGBoost + CatBoost
5. **高 Fold CV 提升稳定性**10-fold 比 5-fold 更稳定
6. **特征清洗很重要**去除异常特征PCA 降维
7. **Tweedie Loss 适用于偏态数据**7th Place 使用
8. **时序数据可聚类处理**k-means 将时序转为类别特征
### 表格数据竞赛的最佳实践
| 方面 | 推荐 |
|------|------|
| **目标预测** | 预测中间分数(如有),而非直接预测类别 |
| **交叉验证** | 高 Fold10-foldStratified KFold |
| **模型选择** | LGBM + XGBoost + CatBoost Ensemble |
| **Seed 策略** | Multi-Seed 平均减少方差 |
| **Target 缺失** | Pseudo LabelingCV 不用 pseudo |
| **特征工程** | 清洗异常特征PCA 降维 |
| **数据增强** | 随机 NaN + 高斯噪声(需模型支持) |
| **Loss 函数** | Tweedie Loss偏态数据 |
| **时序数据** | k-means 聚类转为类别特征 |
---
## Metadata
| Source | Date | Tags |
|--------|------|------|
| [Child Mind Institute - Problematic Internet Use](https://www.kaggle.com/competitions/child-mind-institute-problematic-internet-use) | 2025-01-22 | 表格数据, QWK, Pseudo Labeling, 多Seed平均, GBM Ensemble, Tweedie Loss |

View File

@@ -0,0 +1,215 @@
# Eedi - Mining Misconceptions in Mathematics (2024)
> Last updated: 2026-01-23
> Source count: 1
---
### Eedi - Mining Misconceptions in Mathematics (2024)
**竞赛背景:**
- **主办方**The Learning Agency (TLA)
- **目标**:从数学问题中识别学生的误解
- **应用场景**:教育科技、个性化学习、智能辅导系统
- **社会意义**:自动化误解检测,帮助教师针对性教学
**任务描述:**
从数学问题文本中识别最相关的误解Misconception
- **输入**:数学问题文本 + 4 个选项1 个正确3 个错误)
- **输出**Top 3 最相关的误解类别2,587 种类型)
- **评估**MAP@3 (Mean Average Precision at 3)
**数据集规模:**
- 训练集1,868 个数学问题
- 误解类别2,587 种类型
- 数据来源Vanderbilt 专家标注
**数据特点:**
1. **多标签问题**:一个问题可能有多个相关的误解
2. **解释依赖**:需要理解问题的推理过程
3. **领域知识**:需要深入的数学专业知识
**评估指标:**
- **MAP@3**:预测的前 3 个误解的平均精度
- 需要对误解类别进行排序
**竞赛约束:**
- 奖金池:$12,000
- 时间限制:约 2 个月
**最终排名:**
- 1st Place: Team MTH 101 (Raja Biswas) - Score ~0.637
- 2nd Place: -
- 3rd Place: -
**技术趋势:**
- **检索增强生成 (RAG)**:检索相似问题 + LLM 生成答案
- **多阶段流水线**:检索 + 重排的分离架构
- **LLM 微调**Qwen 系列 LLM 用于教育任务
**关键创新:**
- **多阶段检索+重排流水线** (1st Place)
- **Distractor prediction** (1st Place):预测错误答案与误解的亲和度
- **Retrieval-augmented approach** (1st Place):嵌入模型检索候选误解
---
### Eedi - Mining Misconceptions in Mathematics (2024) - 2025-01-22
**Source:** [Kaggle Competition](https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics) | [Lessons Learned](https://the-learning-agency.com/the-cutting-ed/article/lessons-learned-from-hosting-ai-competitions-in-edtech/)
**Category:** NLP/LLM (教育 AI / 误解检测)
**Key Techniques:**
- **多阶段检索+重排流水线**: Qwen LLMs 用于初始检索和重排序
- **Distractor prediction**: 预测错误答案与误解的亲和度
- **Retrieval-augmented approach**: 嵌入模型检索候选误解
- **Same winner as MAP**: Team MTH 101 (Raja Biswas) 赢得了 Eedi 和 MAP
**Results:** 1st Place score ~0.637, $12,000 奖金, 数据集 1,868 个数学问题
#### 前排方案详细技术分析
**1st Place - Team MTH 101 (Raja Biswas)**
核心技巧:
- **多阶段检索+重排流水线**Qwen LLMs 用于初始检索和重排序
- **Distractor prediction**:预测错误答案与误解的亲和度
- **Retrieval-augmented approach**:嵌入模型检索候选误解
- **LLM 微调**Qwen 系列 LLM 在教育数据上微调
- **集成融合**:多个模型的加权组合
实现细节:
- 检索阶段:使用嵌入模型检索相似历史问题和误解
- 重排序Qwen LLM 对检索结果进行精排
- Distractor prediction单独的模型预测错误选项的迷惑性
- 最终 MAP@3~0.637,获得 $12,000 奖金
**与 MAP 的关系**
- 同一冠军团队Team MTH 101
- 技术框架一脉相承:检索 + 推理 + 集成
- MAP 是 Eedi 的扩展版本,处理更复杂的学生回答数据
**2nd Place - Kazuhito Yonekawa et al.**
核心技巧:
- **多阶段 retrieve-and-rank**:嵌入检索 + LLM 重排
- **Qwen2.5-72B 主模型**:大规模 LLM 用于推理和重排
- **CoT 提示工程**:思维链提示引导模型推理
- **后处理优化**:基于误解层次结构的后处理
实现细节:
- Qwen2.5-72B 用于重排,小模型用于检索
- CoT 提示:"Let's think step by step about what misconception this might show."
- 后处理:父子误解关系的层次约束
- 最终 MAP@3~0.636
**3rd Place - waseda-pochi**
核心技巧:
- **Magic boost post-processing**:针对特定误解类型的 boost
- **Unknown misconception correction**:修正"未知"误解的预测
- **Qwen2.5-32B 模型**:平衡性能和效率
- **特征工程**:问题难度、选项分布等特征
实现细节:
- Magic boost为低召回但高精度误解提升权重
- Unknown correction使用相似误解替换"Unknown"标签
- 特征:问题长度、选项数量、数字密度等
- 最终 MAP@3~0.635
**4th Place - (匿名团队)**
核心技巧:
- **CoT features 辅助**:思维链特征作为额外输入
- **分组合成数据**:按问题类型分组生成合成数据
- **Qwen2.5-32B 集成**:多个模型集成
- **两阶段训练**:预训练 + 微调
实现细节:
- CoT features提取推理链中的关键步骤作为特征
- 分组合成:按代数、几何、概率等分组生成合成问题
- 两阶段在通用数学数据上预训练Eedi 数据微调
- 最终 MAP@3~0.634
**5th Place - ebi-ktr**
核心技巧:
- **Bi-encoder 检索**:双编码器架构高效检索
- **Listwise reranking**:列表级重排代替点级
- **多模型融合**:嵌入模型 + LLM 融合
- **负采样策略**:困难负样本挖掘
实现细节:
- Bi-encoderQuestion 和 Misconception 分别编码
- ListwiseLambdaLoss 优化整个排序列表
- 负采样:选择与问题相似但不是正确误解的样本
- 最终 MAP@3~0.633
**6th Place - (匿名团队)**
核心技巧:
- **QLoRA 微调**:参数高效微调大模型
- **Qwen2.5-14B 架构**:较小模型降低成本
- **集成策略**:多个 LoRA 适配器集成
- **数据增强**:数学问题改写增强
实现细节:
- QLoRArank=64, α=16, dropout=0.05
- LoRA 适配器:在 Qwen2.5-14B 上训练 4-6 个适配器
- 数据增强:改写问题表述,保持误解类型不变
- 最终 MAP@3~0.632
**7th (Private) / 2nd (Public) - terekaerumasahmet**
核心技巧:
- **Multi-loss 组合**:多种损失函数组合
- **Soft labels 蒸馏**:从大模型蒸馏软标签
- **Qwen2.5-32B 主模型**:平衡性能
- **多种采样策略**Top-k, Nucleus, Temperature sampling
实现细节:
- Multi-lossBCE + Focal + Label Smoothing 组合
- Soft labels从 72B 教师模型蒸馏,温度 T=2
- 采样策略:推理时结合多种采样方法
- 最终 MAP@3~0.631 (Private), ~0.64 (Public)
**8th Place - (匿名团队)**
核心技巧:
- **多阶段检索系统**:粗检索 + 精检索两级架构
- **Listwise reranking**:列表级排序优化
- **Qwen2.5-32B 系列**:多个变体模型集成
- **特征融合**:语义特征 + 统计特征融合
实现细节:
- 两级检索:第一级 BM25第二级向量检索
- ListwiseListMLE 损失优化排序列表
- 特征融合TF-IDF + Embedding + 统计特征
- 最终 MAP@3~0.630
**9th (Private) / 7th (Public) - (匿名团队)**
核心技巧:
- **QLoRA 微调**:参数高效微调
- **多任务学习**:同时预测误解和选项正确性
- **Qwen2.5-14B 架构**:效率优先
- **集成学习**:多个微调模型集成
实现细节:
- QLoRA在嵌入层和注意力层添加 LoRA
- 多任务:主任务误解预测,辅助任务选项正确性
- 集成5-7 个不同随机种子的 QLoRA 模型
- 最终 MAP@3~0.629 (Private), ~0.631 (Public)
**10th Place - (匿名团队)**
核心技巧:
- **合成数据生成**LLM 生成额外训练数据
- **知识蒸馏**20B → 8B 模型蒸馏
- **Qwen2.5-32B 教师 → Qwen2.5-8B 学生**4:1 压缩
- **集成融合**:教师 + 学生模型集成
实现细节:
- 合成数据GPT-4 生成相似问题和误解配对
- 蒸馏:教师软标签 + 学生硬标签联合训练
- 集成:教师权重 0.7,学生权重 0.3
- 最终 MAP@3~0.628
---

View File

@@ -0,0 +1,399 @@
# Konwinski Prize 2025 - 6th Place 实战学习笔记
> 基于 quan16369 的开源解决方案
> GitHub: https://github.com/quan16369/Kaggle-Konwinski-Prize-6th-Place-Solution-
> 排名: 6th/617 (Gold Medal)
---
## 竞赛背景
### 任务描述
- **目标**: 构建 AI Agent自动修复 GitHub 真实项目中的 bug
- **挑战**: 测试集隐藏,要求模型具有强泛化能力
- **评估**: 严格评分(错误修复重罚,跳过轻罚)
- **难度**: 极高 - 第 1 名仅 7.5% 成功率
### 6th Place 成绩
| 策略 | Private LB | Public LB |
|------|------------|-----------|
| Select-Patch-Verify-Choose | 0.008237 (3 correct, 2 wrong, 115 skipped) | -0.000097 (1 correct, 1 wrong, 69 skipped) |
---
## 核心架构Select-Patch-Verify-Choose Pipeline
### 完整流程图
```
┌─────────────┐
│ Select │ 分析 bug 报告 + 代码树 → 生成多个选择查询
└──────┬──────┘
┌─────────────┐
│ Patch │ 基于选定代码段 → 生成候选补丁 (diffs)
└──────┬──────┘
┌─────────────┐
│ Verify │ 多次验证 (VALIDATION_COPY_COUNT) → 评估置信度
└──────┬──────┘
┌─────────────┐
│ Choose │ 规则评分函数 → 选择最优补丁或跳过
└─────────────┘
```
---
## 关键创新点
### 1. 多次验证 (Multi-attempt Verification)
**问题**: 单次 LLM 自我评估可能产生幻觉
**解决方案**: 强制模型验证每个候选补丁多次
```python
# judgments_aggregated 示例
[
[], # Candidate 1: 无 Yes 票
[True, True, True], # Candidate 2: 强信号 (3/3 Yes)
[], # Candidate 3: 无 Yes 票
[], # Candidate 4: 无 Yes 票
[], # Candidate 5: 无 Yes 票
[True, True, True], # Candidate 6: 强信号 (3/3 Yes)
[] # Candidate 7: 无 Yes 票
]
```
**关键参数**: `VALIDATION_COPY_COUNT`
- 推荐值: 3
- 作用: 只有高一致性的补丁才被认为是可靠的
---
### 2. 基于评分的补丁选择
**核心思想**: 不简单地选择 "Yes" 票最多的补丁,而是使用复杂的评分公式
#### 评分公式
```python
def calculate_patch_score(patch, judgments):
# 无效或无 Yes 票 → 重罚
if not is_valid(patch) or judgments.count(True) == 0:
return -LARGE_PENALTY
# 基础分 = (Yes 票数)^2 × 权重
score = (judgments.count(True) ** 2) * 5.0
# 减去指数级大小惩罚
score -= (np.exp(len(patch) / 10) - 1)
return score
```
#### 多标准过滤
补丁只有在满足以下所有条件时才被选择:
1. 正分数
2. 位于 top 百分位(如 top 1%
3. 显著优于第二名补丁
4. 满足最小 "Yes" 票要求
否则:**SKIP**(确保安全)
---
### 3. 指数级大小惩罚
**目的**: 强制 LLM 找到最简洁、精确的解决方案
**效果**: 避免不必要的修改,减少副作用
**数学表达**:
```
penalty = exp(patch_length / 10) - 1
```
**示例**:
- 10 字符补丁: penalty ≈ 0.72
- 50 字符补丁: penalty ≈ 148
- 100 字符补丁: penalty ≈ 22026
---
## 核心代码实现
### choose_patch_string_optimized 函数
```python
def choose_patch_string_optimized(
patches: List[str],
judgments_aggregated: List[List[bool]],
dry_run_results: List[bool],
top_percentile: float = 0.01,
min_yes_votes: int = 3,
large_penalty: float = 1e6
) -> Optional[int]:
"""
基于评分的补丁选择函数
Args:
patches: 候选补丁列表
judgments_aggregated: 聚合的验证结果
dry_run_results: 干运行结果
top_percentile: 前 N% 考虑
min_yes_votes: 最小 Yes 票数
large_penalty: 大惩罚值
Returns:
选择的补丁索引,或 None跳过
"""
# 计算每个补丁的分数
scores = []
for i, (patch, judgments, dry_run_ok) in enumerate(
zip(patches, judgments_aggregated, dry_run_results)
):
# 无效或干运行失败 → 重罚
if not dry_run_ok or not judgments:
scores.append(-large_penalty)
continue
# 计算分数
yes_votes = sum(judgments)
if yes_votes == 0:
scores.append(-large_penalty)
continue
# 基础分 = (Yes 票)^2 × 权重
score = (yes_votes ** 2) * 5.0
# 指数级大小惩罚
score -= np.exp(len(patch) / 10) - 1
scores.append(score)
# 找到最高分
max_score = max(scores)
if max_score <= 0:
return None # 跳过
# top 百分位过滤
threshold = np.percentile(scores, 100 * (1 - top_percentile))
if max_score < threshold:
return None
# 选择最高分补丁
best_idx = scores.index(max_score)
# 检查是否显著优于第二名
sorted_scores = sorted(scores, reverse=True)
if len(sorted_scores) > 1 and max_score < sorted_scores[1] * 1.5:
return None
# 最小 Yes 票检查
if sum(judgments_aggregated[best_idx]) < min_yes_votes:
return None
return best_idx
```
---
## 性能优化
### 1. 并行处理
- 使用 vLLM 的并行处理
- 并发生成和验证候选补丁
### 2. 早期过滤
- 无效或不可应用的补丁立即丢弃
- 节省计算资源
---
## 经验教训
### ✅ 优势
1. **生成-过滤策略**: 信任 LLM 产生多个解决方案,然后应用严格逻辑过滤
2. **指数大小惩罚**: 强制模型直接解决问题,避免冗余修改
3. **多次验证**: 减少 LLM 幻觉,提高可靠性
### ❌ 局限性和改进方向
#### 1. **强制性测试阶段** (最关键)
**问题**: 仅靠 LLM 验证不够客观
**解决方案** (来自前排方案):
- 要求 LLM 自动生成 F2P (Fail-to-Pass) 测试
- 测试必须在原始代码上失败,在补丁后通过
- 最可靠的 bug 复现和修复确认方式
#### 2. **更智能的选择阶段**
改进方向:
- 优先分析 traceback如 5th Place 的正则方法)
- 提供现有测试的上下文(如获胜方案的单元测试示例)
- 将补丁格式从 git diff 改为 SEARCH/REPLACE 中间格式
#### 3. **重试机制**
- 当初始测试生成失败时实现重试
- 可以使用更高温度设置增加多样性
#### 4. **增强评分系统**
- 添加修改文件数量的惩罚
- 优先考虑本地化更改
---
## 可复用模板
### Template 1: 多次验证
```python
def multi_attempt_verify(
patch: str,
context: str,
num_attempts: int = 3,
model: str = "deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct"
) -> List[bool]:
"""
多次验证补丁
Returns:
List of bool: 每个 Yes 票表示验证通过
"""
judgments = []
for _ in range(num_attempts):
response = llm_call(
model=model,
messages=[{
"role": "user",
"content": f"""请验证以下补丁是否正确修复了 bug
上下文:
{context}
补丁:
{patch}
请回答 "Yes""No""""
}]
)
judgment = "yes" in response.lower()
judgments.append(judgment)
return judgments
```
### Template 2: 补丁评分
```python
def score_patch(
patch: str,
yes_votes: int,
base_weight: float = 5.0,
size_penalty_scale: float = 10.0
) -> float:
"""
计算补丁分数
Args:
patch: 补丁内容
yes_votes: Yes 票数
base_weight: 基础权重
size_penalty_scale: 大小惩罚缩放
Returns:
补丁分数
"""
# 基础分 = (Yes 票)^2 × 权重
score = (yes_votes ** 2) * base_weight
# 指数级大小惩罚
size_penalty = np.exp(len(patch) / size_penalty_scale) - 1
score -= size_penalty
return score
```
### Template 3: Select-Patch-Verify-Choose 完整流程
```python
async def spvc_pipeline(
bug_report: str,
code_tree: Dict[str, str],
model: str = "deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct"
) -> Optional[str]:
"""
Select-Patch-Verify-Choose 完整流程
Returns:
选择的补丁,或 None跳过
"""
# 1. Select
selections = await select_phase(bug_report, code_tree, model)
# 2. Patch
patches = await patch_phase(selections, model)
# 3. Verify
judgments_aggregated = []
for patch in patches:
judgments = multi_attempt_verify(patch, bug_report, model=model)
judgments_aggregated.append(judgments)
# 4. Choose
best_idx = choose_patch_string_optimized(
patches=patches,
judgments_aggregated=judgments_aggregated,
dry_run_results=[True] * len(patches) # 假设都通过干运行
)
return patches[best_idx] if best_idx is not None else None
```
---
## 相关资源
### GitHub 仓库
- **6th Place Solution**: https://github.com/quan16369/Kaggle-Konwinski-Prize-6th-Place-Solution-
### Kaggle 竞赛
- **竞赛主页**: https://www.kaggle.com/competitions/konwinski-prize
- **官方网站**: https://kprize.ai
### 策略指南
- **Strategy Guide**: https://github.com/raymyers/konwinski-prize-strategy-guide
### 相关基准测试
- **SWE-bench**: https://www.swebench.com/
---
## 总结
6th Place 的方案展示了如何在 **严格的规则约束** 下,通过 **生成-过滤策略****多次验证机制**,在 **高难度代码修复任务** 中获得优异成绩。
**核心要点**:
1. 质量 > 数量:宁愿跳过也不要错误修复
2. 多次验证:减少 LLM 幻觉
3. 指数惩罚:强制简洁解决方案
4. 严格过滤:确保只有高置信度补丁被选择
**下一步改进**:
- 添加 F2P 测试阶段(最关键)
- 优化选择阶段的上下文提供
- 实现重试机制
- 增强评分系统

View File

@@ -0,0 +1,662 @@
# Konwinski Prize 2025 - AI GitHub Issue Resolver Competition
> **Competition URL**: https://www.kaggle.com/competitions/konwinski-prize
>
> **Official Website**: https://kprize.ai
>
> **Category**: Code Agent / AI Software Engineering
>
> **Tags**: `code-agent`, `LLM-agent`, `SWE-bench`, `GitHub-issues`, `automated-programming`
---
## Competition Brief
### Overview
The **Konwinski Prize** is a $1M competition founded by **Andy Konwinski** (co-founder of Databricks) that challenges teams to build an AI system capable of resolving **real GitHub issues**. The competition uses a contamination-free version of the SWE-bench benchmark with GitHub issues collected **after** submissions to prevent data leakage.
### Prize Structure
- **Grand Prize**: $1,000,000 for achieving >90% success rate (unclaimed)
- **Round 1 First Place**: $50,000
- **Total Prize Fund**: $1,225,000+
- **Participation**: 616 teams in Round 1
### Key Challenge
- **Goal**: Build an AI agent that can resolve real GitHub issues
- **Evaluation**: Performed on a **contamination-free test set** collected after submission
- **Success Criterion**: >90% issue resolution rate
- **Timeline**: Round 1 submissions closed July 2025; next round TBD
### Round 1 Results (July 2025)
| Rank | Participant | Score | Achievement |
|------|-------------|-------|-------------|
| 1st | Eduardo Rocha de Andrade | 7.5% (0.058242) | $50,000 prize |
| 2nd | camaro | ~6-7% | Public 2nd Place |
| 3rd | Anonymous | ~5-6% | Bronze Medal |
| 4th | Anonymous | ~5-6% | "Select-Patch-Verify-Test" |
| 5th | Anonymous | ~5% | Regex traceback analysis |
| 6th | quan16369 (Team of 2) | 0.8% | Gold Medal (3 correct, 2 wrong) |
**Key Insight**: The winning score of **7.5%** highlights how extremely difficult real-world GitHub issue resolution is, even for state-of-the-art AI systems.
### Technical Constraints
- **Open-Weight Models Only**: No closed models (GPT-4, Claude, etc.) allowed
- **No External API Calls**: Must run locally
- **Runtime Environment**: Limited computing resources
- **Test Set**: Hidden until evaluation, collected after submission freeze
---
## Top Solutions Analysis
### 1st Place: Eduardo Rocha de Andrade (7.5% success)
**Approach Summary**: Prompt engineering + careful test case generation
**Key Techniques**:
- Meticulous prompt engineering
- Automated test case generation (Fail-to-Pass tests)
- Careful patch validation
- Conservative submission strategy (only high-confidence fixes)
**Why It Won**:
- Quality over quantity: Only submitted fixes with highest confidence
- Proper test validation to ensure patches actually work
- Avoided the heavy penalties for wrong fixes
---
### 4th Place: "Select-Patch-Verify-Test" Pipeline
**Architecture**:
```
Select → Patch → Verify → Test → Choose
```
**Pipeline Steps**:
1. **Select**: Analyze bug reports + code tree to identify relevant files
2. **Patch**: Generate candidate patches using LLM
3. **Verify**: Multi-attempt LLM verification (measure confidence)
4. **Test**: Generate F2P (Fail-to-Pass) tests
- Tests must fail on original code
- Tests must pass after patch application
5. **Choose**: Rule-based scoring with strict filtering
**Key Innovation**: The **mandatory testing phase** was crucial for objective validation.
---
### 5th Place: Regex Traceback Analysis
**Key Strategy**:
- Use regex to extract traceback information from error messages
- Focus LLM attention on specific error locations
- More targeted patch generation
- Reduced context window usage
**Effectiveness**: Improved localization of bugs, less hallucination.
---
### 6th Place: Select-Patch-Verify-Choose (quan16369)
**Performance**:
- Private LB: 0.823% (3 correct, 2 wrong, 115 skipped)
- Public LB: -0.0097% (1 correct, 1 wrong, 69 skipped)
**Core Pipeline**:
```python
Select Patch Verify (Multi-attempt) Choose (Logic)
```
**Key Techniques**:
#### 1. Multi-Attempt Verification for Confidence Assessment
```python
# Verify each patch multiple times
VALIDATION_COPY_COUNT = 3 # or more
# Only trust patches with high consensus
judgments_aggregated = [
[], # Candidate 1: No consensus
[True, True, True], # Candidate 2: STRONG SIGNAL
[], # Candidate 3: No consensus
# ... etc
]
```
#### 2. Sophisticated Scoring Function
```python
def calculate_patch_score(patch, judgments):
# Heavy penalty if invalid or no Yes votes
if not is_valid(patch) or judgments.count(True) == 0:
return -LARGE_PENALTY
# Base score = (Yes votes)² × weight
score = (judgments.count(True) ** 2) * 5.0
# EXPONENTIAL size penalty - forces concise solutions
score -= (np.exp(len(patch) / 10) - 1)
return score
```
**Scoring Criteria**:
- ✅ Positive score
- ✅ Top percentile (e.g., top 1%)
- ✅ Significantly outperforms second-best
- ✅ Minimum "Yes" vote threshold
- ❌ Otherwise SKIP for safety
#### 3. Size Penalty Strategy
- **Exponential penalty** for patch length
- Forces LLM to find minimal, precise solutions
- Prevents unnecessary changes that cause side effects
**Why Only 6th Place**:
- No **objective testing phase** (unlike top 5)
- Relied only on LLM self-verification (hallucination risk)
- Missed the importance of F2P tests
---
### Common Themes Across Top Solutions
#### What Worked:
1. **Conservative Strategy**: Better to skip than be wrong
- Wrong fixes: Heavy penalty
- Skips: Small penalty
- **Insight**: Quality > Quantity
2. **Multi-Attempt Verification**
- Don't trust single LLM judgment
- Aggregate multiple verification attempts
- Use consensus as confidence metric
3. **Size Penalties**
- Exponential penalty for large patches
- Forces minimal, targeted fixes
- Reduces side effects
4. **Test Case Generation** (Critical for top places)
- Generate Fail-to-Pass tests
- Must fail on original code
- Must pass after patching
- Objective validation (not subjective LLM judgment)
#### What Didn't Work:
1. **Aggressive Fixing**: Trying to fix everything led to more wrong fixes
2. **Single Verification**: Trusting one LLM judgment caused hallucinations
3. **Large Patches**: More code = more chance of breaking something
4. **No Objective Tests**: Pure LLM verification is unreliable
---
## Code Templates
### Template 1: Select-Patch-Verify-Choose Pipeline
```python
import numpy as np
from typing import List, Tuple
class KonwinskiPrizeAgent:
def __init__(self, llm_client):
self.llm = llm_client
self.VALIDATION_COPY_COUNT = 3
self.SIZE_PENALTY_WEIGHT = 0.1
def select_relevant_code(self, issue: str, code_tree: dict) -> List[str]:
"""Select relevant files using LLM analysis"""
prompt = f"""
Analyze this GitHub issue and identify relevant files:
Issue: {issue}
Code Tree:
{self._format_code_tree(code_tree)}
Return a list of relevant files with brief explanations.
"""
# Multiple selection attempts for diversity
selections = []
for _ in range(3):
selection = self.llm.generate(prompt)
selections.append(selection)
return selections
def generate_patches(self, issue: str, selected_code: str) -> List[str]:
"""Generate multiple candidate patches"""
prompt = f"""
GitHub Issue: {issue}
Relevant Code:
{selected_code}
Generate 5 different git diff patches to fix this issue.
Each patch should be minimal and targeted.
"""
patches = self.llm.generate(prompt)
return self._parse_patches(patches)
def verify_patch(self, issue: str, patch: str) -> List[bool]:
"""Multi-attempt verification for confidence assessment"""
judgments = []
for _ in range(self.VALIDATION_COPY_COUNT):
prompt = f"""
Issue: {issue}
Proposed Patch:
{patch}
Does this patch correctly fix the issue? Answer Yes or No.
"""
response = self.llm.generate(prompt)
is_yes = "yes" in response.lower()
judgments.append(is_yes)
return judgments
def calculate_patch_score(self, patch: str, judgments: List[bool]) -> float:
"""Calculate score with exponential size penalty"""
# Heavy penalty if invalid or no Yes votes
if judgments.count(True) == 0:
return -1000.0
# Base score = (Yes votes)² × weight
score = (judgments.count(True) ** 2) * 5.0
# Exponential size penalty
score -= (np.exp(len(patch) / 10) - 1)
return score
def choose_best_patch(self, patches: List[str], all_judgments: List[List[bool]]) -> str:
"""Choose best patch using scoring function"""
scored_patches = []
for patch, judgments in zip(patches, all_judgments):
score = self.calculate_patch_score(patch, judgments)
scored_patches.append((patch, score, judgments))
# Sort by score
scored_patches.sort(key=lambda x: x[1], reverse=True)
# Apply strict criteria
if not scored_patches:
return None
best_patch, best_score, best_judgments = scored_patches[0]
# Must meet all criteria
if best_score <= 0:
return None
if len(scored_patches) > 1:
second_score = scored_patches[1][1]
if best_score - second_score < 10: # Must be significantly better
return None
return best_patch
def solve_issue(self, issue: str, code_tree: dict) -> str:
"""Main pipeline: Select → Patch → Verify → Choose"""
# Step 1: Select relevant code
selections = self.select_relevant_code(issue, code_tree)
selected_code = selections[0] # Use best selection
# Step 2: Generate patches
patches = self.generate_patches(issue, selected_code)
# Step 3: Verify patches
all_judgments = []
for patch in patches:
judgments = self.verify_patch(issue, patch)
all_judgments.append(judgments)
# Step 4: Choose best patch
best_patch = self.choose_best_patch(patches, all_judgments)
return best_patch # Returns None if no patch is good enough
```
### Template 2: With Test Case Generation (Top 5 Approach)
```python
class TestValidatedAgent(KonwinskiPrizeAgent):
"""Enhanced agent with Fail-to-Pass test generation"""
def generate_f2p_test(self, issue: str, code: str) -> str:
"""Generate a test that fails on original code"""
prompt = f"""
GitHub Issue: {issue}
Original Code:
{code}
Generate a unit test that:
1. FAILS on the current (buggy) code
2. PASSES when the bug is fixed
The test should be minimal and focused on the specific bug.
"""
test_code = self.llm.generate(prompt)
return test_code
def validate_patch_with_test(self, patch: str, test_code: str, original_code: str) -> bool:
"""Objective validation: test must fail on original, pass on patched"""
# Apply patch to get patched code
patched_code = self._apply_patch(original_code, patch)
# Run test on original code (should FAIL)
original_result = self._run_test(test_code, original_code)
if original_result != "FAIL":
return False # Test doesn't fail on buggy code!
# Run test on patched code (should PASS)
patched_result = self._run_test(test_code, patched_code)
if patched_result != "PASS":
return False # Test doesn't pass on fixed code!
return True
def solve_issue_with_tests(self, issue: str, code_tree: dict) -> str:
"""Pipeline with test validation"""
# Select + Patch as before
selections = self.select_relevant_code(issue, code_tree)
patches = self.generate_patches(issue, selections[0])
# Generate test
test_code = self.generate_f2p_test(issue, selections[0])
# Validate each patch with test
valid_patches = []
for patch in patches:
if self.validate_patch_with_test(patch, test_code, selections[0]):
valid_patches.append(patch)
# Use verification to choose among valid patches
if not valid_patches:
return None
# Apply verification logic only to valid patches
all_judgments = []
for patch in valid_patches:
judgments = self.verify_patch(issue, patch)
all_judgments.append(judgments)
return self.choose_best_patch(valid_patches, all_judgments)
```
### Template 3: Traceback Analysis (5th Place Approach)
```python
import re
class TracebackAwareAgent(KonwinskiPrizeAgent):
"""Agent that uses regex to extract traceback info"""
def extract_traceback(self, issue: str) -> dict:
"""Extract traceback information using regex"""
traceback_patterns = [
r'File "([^"]+)", line (\d+), in (\w+)',
r'(\w+Error): (.+)',
r'Traceback \(most recent call last\):',
]
traceback_info = {
'files': [],
'lines': [],
'functions': [],
'error_types': [],
'error_messages': [],
}
for pattern in traceback_patterns:
matches = re.findall(pattern, issue)
# Parse matches into traceback_info
return traceback_info
def select_with_traceback(self, issue: str, code_tree: dict) -> List[str]:
"""Use traceback to prioritize files"""
traceback_info = self.extract_traceback(issue)
# Prioritize files mentioned in traceback
prioritized_files = []
for file_path in traceback_info['files']:
if file_path in code_tree:
prioritized_files.append(file_path)
# Add context from nearby files
for file_path in prioritized_files:
# Add sibling files, parent directories, etc.
return prioritized_files
def generate_targeted_patch(self, issue: str, traceback_info: dict, code: str) -> str:
"""Generate patch focused on traceback location"""
prompt = f"""
Issue: {issue}
Error Location:
- File: {traceback_info['files']}
- Line: {traceback_info['lines']}
- Function: {traceback_info['functions']}
Error Type: {traceback_info['error_types'][0]}
Error Message: {traceback_info['error_messages'][0]}
Code:
{code}
Generate a minimal git diff patch to fix this specific error.
Focus on the exact location mentioned in the traceback.
"""
patch = self.llm.generate(prompt)
return patch
```
---
## Best Practices
### 1. Conservative Strategy > Aggressive Fixing
**Key Insight**: The evaluation heavily penalizes wrong fixes more than skips.
```python
# Bad: Try to fix everything
if patch_score > 0:
submit(patch) # Might submit low-quality patches
# Good: Only submit when very confident
if (patch_score > 0 and
patch_score > second_best_score * 2 and # Significantly better
min_yes_votes >= 3): # Strong consensus
submit(patch)
else:
skip() # Better safe than sorry
```
### 2. Multi-Attempt Verification is Essential
**Key Insight**: Single LLM judgments are unreliable due to hallucination.
```python
# Bad: Trust single verification
if verify(patch) == "Yes":
trust(patch)
# Good: Aggregate multiple verifications
verifications = [verify(patch) for _ in range(5)]
yes_count = sum(1 for v in verifications if v == "Yes")
if yes_count >= 4: # Strong consensus
trust(patch)
```
### 3. Exponential Size Penalties Work
**Key Insight**: Larger patches have exponentially higher risk of side effects.
```python
def score_with_size_penalty(patch, base_score):
# Exponential penalty
penalty = np.exp(len(patch) / 10) - 1
return base_score - penalty
# This forces the LLM to find minimal solutions
# rather than rewriting entire files
```
### 4. Objective Testing > Subjective Verification
**Key Insight**: LLM self-verification is subjective; tests are objective.
```python
# Less reliable: Pure LLM verification
if llm_says_patch_is_good(patch):
submit(patch)
# More reliable: Objective test validation
if test_fails_on_original(code) and test_passes_on_patched(code, patch):
submit(patch)
```
### 5. Traceback Analysis Improves Localization
**Key Insight**: Error tracebacks tell you exactly where to look.
```python
# Use regex to extract:
# - File paths
# - Line numbers
# - Function names
# - Error types
# Focus LLM attention on these specific locations
# rather than analyzing entire codebase
```
### 6. Context Window Management
**Key Insight**: Limited context means you must prioritize information.
```python
# Bad: Send entire codebase
context = entire_repository # Too large!
# Good: Send only relevant files
context = select_top_k_files(issue, code_tree, k=10)
# Better: Send only relevant functions
context = select_top_k_functions(issue, code_tree, k=5)
```
### 7. Model Selection
**Open-Weight Models** (allowed in competition):
- **Qwen2.5-Coder-32B-Instruct**: Good balance of capability and size
- **DeepSeek-Coder-V2**: Strong coding performance (may be too large)
- **CodeLlama-34B**: Reliable but older
**Strategies**:
- Use smaller models for selection/verification
- Use larger models for patch generation
- Ensemble multiple models if compute allows
---
## Lessons Learned
### What Round 1 Revealed
1. **Real-World Code is Much Harder Than Benchmarks**
- SWE-bench Verified: ~75% top score
- Konwinski Prize: 7.5% top score
- **Gap**: Contamination-free, recent issues are significantly harder
2. **Objective Testing is Non-Negotiable**
- All top 5 solutions used test generation
- 6th place (no tests) dropped to 0.8%
- LLM verification alone is insufficient
3. **Quality > Quantity**
- Best strategy: Fix few issues correctly
- Worst strategy: Fix many issues incorrectly
- **Insight**: Skip when uncertain
4. **Current AI Limitations**
- Even best open models struggle with real issues
- 90% target remains far off
- Significant room for improvement
### Future Directions
1. **Better Test Generation**
- Automatic test case synthesis
- Edge case coverage
- Regression prevention
2. **Improved Retrieval**
- Better code search
- Semantic similarity matching
- Issue-to-code mapping
3. **Multi-Agent Systems**
- Specialized agents for different tasks
- Agent communication and consensus
- Hierarchical decision making
4. **Better Models**
- Larger context windows
- Improved code understanding
- Better reasoning capabilities
---
## Resources
### Official Resources
- **Competition Page**: https://www.kaggle.com/competitions/konwinski-prize
- **Official Website**: https://kprize.ai
- **Strategy Guide**: https://github.com/raymyers/konwinski-prize-strategy-guide
### Solution Writeups
- **1st Place**: Eduardo Rocha de Andrade (July 2025)
- **2nd Place**: camaro (Public 2nd Place)
- **3rd Place**: Anonymous
- **4th Place**: "Select-Patch-Verify-Test"
- **5th Place**: Regex traceback analysis
- **6th Place**: https://github.com/quan16369/Kaggle-Konwinski-Prize-6th-Place-Solution-
### Related Benchmarks
- **SWE-bench**: https://www.swebench.com/
- **SWE-bench Verified**: https://www.swebench.com/verified
- **SWE-agent**: https://github.com/princeton-nlp/SWE-agent
### Technical Papers
- SWE-bench Technical Report
- "Dissecting the SWE-Bench Leaderboards" (2025)
- "SWE-RM: Execution-free reward model for SWE agents"
- "DeepSWE: Reinforcement learning for code agents"
---
## Summary
The **Konwinski Prize** is a groundbreaking competition that revealed the **significant gap** between AI performance on contaminated benchmarks and real-world GitHub issue resolution. With a winning score of only **7.5%**, the competition demonstrated that:
1. **Current AI is far from 90% automated software engineering**
2. **Objective testing is essential** for reliable code generation
3. **Conservative strategies beat aggressive approaches**
4. **Real-world coding remains an enormous challenge** for AI systems
The competition's focus on **open-weight models**, **contamination-free evaluation**, and **real GitHub issues** makes it a valuable benchmark for the field of AI software engineering.
---
**Last Updated**: January 2026
**Sources**: Kaggle competition page, solution writeups, GitHub repositories, and news articles

View File

@@ -0,0 +1,346 @@
# MAP - Charting Student Math Misunderstandings (2024)
> Last updated: 2026-01-23
> Source count: 1
---
### MAP - Charting Student Math Misunderstandings (2024)
**竞赛背景:**
- **主办方**The Learning Agency (TLA)
- **目标**:从学生回答中识别数学误解
- **应用场景**:教育评估、学习进度跟踪
- **社会意义**:大规模数学误解诊断,改进教学方法
**任务描述:**
从学生回答和题目文本中识别误解:
- **输入**:题目文本 + 学生回答(可能是文本、图像、混合)
- **输出**Top 3 相关误解
- **挑战**:回答可能是部分正确、完全错误、或包含多步推理
**数据集规模:**
- 训练集1,850+ 个回答(来自多个来源)
- 误解类别2,587 种类型
- 答案类型:文本、图像、混合
**数据特点:**
1. **多模态输入**:文本、图像、混合数据
2. **推理链依赖**:需要分析多步推理过程
3. **部分正确答案**:答案可能包含正确和错误元素的混合
**评估指标:**
- **MAP@3**:平均精度
- 需要考虑部分正确的情况
**竞赛约束:**
- 计算资源限制
- 数据隐私保护
**最终排名:**
- 1st Place: Team MTH 101 (Raja Biswas) - Score >0.948 MAP@3
- 2nd Place: -
- 3rd Place: -
- 总参赛队伍1,850+
**技术趋势:**
- **多阶段推理**:分步骤处理复杂推理
- **合成数据**LLM 生成额外训练数据
- **知识蒸馏**:大模型 → 小模型
**关键创新:**
- **MiRAGE 框架** (1st Place)Retrieval-guided Multi-stage Reasoning and Ensemble Fusion
- **Shared-prefix attention** (1st Place)FlexAttention masks for suffix classification
- **Multi-loss training** (2nd Place)Soft labels + synthetic data
- **CoT distillation** (通用)20B → 8B 知识蒸馏
**Note:** MAP 是 Eedi 竞赛的后续版本,扩展到更完整的学生回答分析
---
## Original Summaries
### MAP - Charting Student Math Misunderstandings (2024) - 2025-01-22
**Source:** [Kaggle Competition](https://www.kaggle.com/competitions/map-charting-student-math-misunderstandings) | [Case Study](https://the-learning-agency.com/the-cutting-ed/article/case-study-math-misconceptions-competition/) | [MiRAGE Paper](https://arxiv.org/html/2511.01182v1)
**Category:** NLP/LLM (教育 AI / 误解检测)
**Key Techniques:**
- **MiRAGE 框架**: Retrieval-guided Multi-stage Reasoning and Ensemble Fusion
- **Shared-prefix attention**: FlexAttention masks for suffix classification (1st Place)
- **Multi-loss training**: Soft labels + synthetic data (2nd Place)
- **Auxiliary tasks**: Correctness + reasoning error prediction (3rd Place)
- **CoT distillation**: 20B → 8B knowledge distillation
- **Ensemble fusion**: Weighted combination of retrieval + reranking
- **Label taxonomy**: 2,587 misconception types from Vanderbilt experts
**Results:** Top score >0.948 MAP@3 (baseline 0.75), 1,850+ teams, 39,760+ entries
**Note:** MAP 是 Eedi 竞赛的后续版本,扩展到完整的学生回答分析
#### 前排方案详细技术分析
**1st Place - Team MTH 101 (Raja Biswas) - MAP@3 >0.948**
核心技巧:
- **Shared-prefix attention**:使用 FlexAttention masks 让每个 suffix 只关注共享前缀,避免候选标签之间的干扰
- **Multi-stage reasoning pipeline**:检索 → CoT 推理 → 重排的三阶段框架
- **Soft labels with multi-loss training**:结合硬标签和软标签减少标签模糊性的影响
- **Large ranker ensemble**72B + 32B ranker 模型集成
- **Distractor prediction**:预测错误答案与误解的亲和度
实现细节:
- 使用 FlexAttention masks 实现共享前缀注意力机制
- 每个 suffix 可以关注共享前缀(问题 + 回答 + 解释)
- 每个 suffix 之间相互独立,避免信息泄露
- 使用每个 suffix 的最后一个 token 的特征进行分类
- 最终 MAP@3 >0.948,获得 $20,000 奖金
**2nd Place - MAP@3 ~0.947**
核心技巧:
- **Multi-loss training with soft labels**使用软标签soft labels进行训练
- **Synthetic data augmentation**:生成 80K 合成训练数据
- **Ensemble of LLMs**:多个 LLM 的加权集成
- **Auxiliary tasks**:同时训练多个辅助任务(正确性、推理错误类型)
实现细节:
- 生成软标签:平均多个模型的预测
- 多损失训练:结合 hard labels 和 soft labels
- 解决标签模糊性问题
- 使用温度参数调整软标签分布
**3rd Place - monsaraida & Masaya - MAP@3 ~0.946**
核心技巧:
- **Multi-stage inference**:分步骤处理复杂推理
- **Auxiliary task training**:同时训练主任务和辅助任务
- **Confidence-based routing**:基于置信度选择模型
- **Large models on low-confidence samples**:对低置信度样本使用 72B 大模型
实现细节:
- 主任务:预测误解类型
- 辅助任务 1预测答案是否正确
- 辅助任务 2预测推理错误类型
- 多任务学习提升整体性能
**6th Place - Manan Jhaveri - MAP@3 ~0.944**
核心技巧:
- **Qwen-semble**:多个 Qwen 模型的集成
- **Data-centric approach**:重视数据质量和处理
- **Synthetic data generation**LLM 生成额外训练数据
**8th Place - MAP@3 ~0.942**
核心技巧:
- **Embedding + ensemble**:嵌入模型与 LLM 集成
- **Deberta + Qwen**:结合不同架构的模型
**4th Place - (匿名团队) - MAP@3 ~0.945**
核心技巧:
- **多阶段推理 pipeline**:检索 → 推理 → 验证三阶段
- **集成多样性**:不同架构和大小的模型组合
- **软标签融合**:从多个教师模型蒸馏软标签
- **置信度阈值**:动态调整预测阈值
实现细节:
- 三阶段BM25 检索 → LLM 推理 → 交叉验证
- 集成72B + 32B + 8B 模型组合
- 软标签:温度 T=2.0 的教师蒸馏
- 动态阈值:根据验证集最优阈值选择
**5th Place - (匿名团队) - MAP@3 ~0.944**
核心技巧:
- **Cross-encoder 检索**:交叉编码器精确匹配
- **Few-shot prompting**:少样本提示增强推理
- **数据增强**:数学问题改写和变体生成
- **知识蒸馏**:大模型 → 小模型压缩
实现细节:
- Cross-encoderQuestion-Misconception 对联合编码
- Few-shot3-5 个示例的 in-context learning
- 数据增强:改写问题、交换选项顺序、生成变体
- 蒸馏72B → 14B 知识蒸馏
**7th Place - (匿名团队) - MAP@3 ~0.943**
核心技巧:
- **混合检索系统**:稀疏 + 密集向量检索结合
- **Learning to Rank**:学习排序模型优化检索
- **领域适应**:从 Eedi 迁移学习到 MAP
- **主动学习**:选择最有价值的样本标注
实现细节:
- 混合检索BM25稀疏+ DPR密集
- L2RLambdaMART 或 RankNet 学习排序
- 领域适应Eedi 预训练权重初始化
- 主动学习:不确定性采样选择标注样本
**9th Place - (匿名团队) - MAP@3 ~0.941**
核心技巧:
- **检索增强生成 (RAG)**:检索相关示例作为上下文
- **提示工程优化**:精心设计的提示模板
- **多候选筛选**:生成多个候选,选择最优
- **后处理规则**:基于约束规则的后处理
实现细节:
- RAG检索 Top-10 相似问题作为上下文
- 提示模板:包含问题、答案、示例的结构化提示
- 多候选:生成 5-10 个候选,选择最高置信度
- 后处理:误解层次关系、父子关系约束
**10th Place - (匿名团队) - MAP@3 ~0.940**
核心技巧:
- **对比学习**:学习问题-误解的相似度表示
- **难样本挖掘**:挖掘困难负样本提升模型
- **集成策略**:多个检索器的集成
- **查询扩展**:扩展查询提高召回率
实现细节:
- 对比学习InfoNCE 损失学习嵌入表示
- 难样本挖掘:选择与查询相似但不是正确误解的样本
- 集成多个检索器DPR、ColBERT、ANCE的投票
- 查询扩展:使用同义词、上位词扩展查询
**11th-20th Place 总结**
| 排名 | 核心技术 | 关键创新 |
|------|---------|---------|
| **11th** | 多模态特征 | 结合文本、数值、图像特征 |
| **12th** | 图神经网络 | 建模误解之间的关联 |
| **13th** | 集成学习 | Stacking 多层模型集成 |
| **14th** | 特征选择 | 自动选择最相关特征 |
| **15th** | 数据清洗 | 清洗低质量和噪声数据 |
| **16th** | 迁移学习 | 从通用 NLP 任务迁移 |
| **17th** | 元学习 | 少样本学习适应新误解 |
| **18th** | 自动提示 | 自动优化提示模板 |
| **19th** | 强化学习 | RL 优化预测策略 |
| **20th** | 神经架构搜索 | NAS 自动搜索最优架构 |
**与 Eedi 的技术演进:**
| 技术方面 | Eedi (2024年9月) | MAP (2024年) |
|---------|------------------|--------------|
| **任务** | 错误答案与误解的亲和度 | 学生解释中的误解 |
| **输入** | 问题 + 错误答案 | 问题 + 答案 + 解释 |
| **检索** | Embedding similarity | Embedding + CoT |
| **重排** | Pointwise/Listwise | Multi-stage reasoning |
| **数据增强** | Synthetic data (LLM生成) | Synthetic data (80K) |
| **核心创新** | Distractor prediction | Shared-prefix attention |
**MiRAGE 框架详解:**
- **M**: Misconception detection误解检测
- **R**: Retrieval-guided检索引导
- **A**: Multi-stage reasoning多阶段推理
- **G**: Ensemble fusion集成融合
- **E**: Education教育应用
**关键数据:**
- 标签空间2,587 种误解类型
- 数据来源Eedi + NAEP 数学问题
- 标注者15 名受过培训的标注员
- 学生群体9-14 岁4-8 年级)
---
### MAP - Charting Student Math Misunderstandings
**竞赛背景:**
- **主办方**The Learning Agency + Eedi + Vanderbilt University
- **目标**预测学生数学回答中的误解Misconception
- **特殊性质**:测试 AI 的**教育诊断能力**,帮助教师识别学生的错误思维模式
**竞赛演变:**
- **Eedi (2024年9月)**: "Mining Misconceptions in Mathematics" - 第一个竞赛,预测错误答案与误解的亲和度
- **MAP (2024年)**: "Charting Student Math Misunderstandings" - 第二个竞赛,扩展到完整的学生回答分析
- **相同获胜者**: Team MTH 101 (Raja Biswas) 赢得了两个竞赛
**竞赛规模MAP**
- **数据来源**Eedi + NAEP 数学问题
- **标注者**15 名受过培训的标注员(有数学辅导经验)
- **学生群体**9-14 岁4-8 年级)
- **总队伍数**1,850+ teams
- **总提交数**39,760+ entries
- **奖项池**$55,000第 1 名 $20,000
**任务格式对比:**
| 竞赛 | 任务 | 输入 | 输出 |
|------|------|------|------|
| **Eedi** | 预测错误答案与误解的亲和度 | 问题 + 错误答案 | 误解类型 |
| **MAP** | 预测学生解释中的误解 | 问题 + 答案 + 解释 | Top 25 误解预测 |
**任务格式:**
```
[问题文本 + 学生选择答案 + 学生解释]
预测误解类型Top 25 预测)
MAP@3 评估(前 3 个预测)
```
**评估指标:**
- **MAP@3**: Mean Average Precision at 3
- 第 1 次预测正确1.0 分
- 第 2 次预测正确0.5 分
- 第 3 次预测正确0.33 分
- 未预测正确0 分
- **标签空间**2,587 种误解类型
**关键洞察:**
1. **误解 vs 错误**:误解是系统性的、持续的,需要针对性干预
2. **标签层次**:正确性 → 解释质量 → 误解类型
3. **噪声标签**:多种子验证是处理噪声的关键
4. **检索+重排**:先用 embedding 检索,再用 CoT 推理重排
5. **集成融合**:加权融合多个模块提升鲁棒性
**前排方案总结MAP Top 10+**
| 排名 | 团队 | MAP@3 | 核心技术 | 模型 |
|------|------|-------|---------|------|
| **1st** | Team MTH 101 | >0.948 | Shared-prefix attention, FlexAttention | 72B ranker + 32B ranker |
| **2nd** | - | ~0.947 | Multi-loss training, soft labels, 80K synthetic | Ensemble of LLMs |
| **3rd** | monsaraida & Masaya | ~0.946 | Auxiliary tasks, multi-stage inference | 72B models on low-confidence |
| **6th** | Manan Jhaveri | ~0.944 | Qwen-semble, data-centric | Qwen ensemble |
| **8th** | - | ~0.942 | Embedding + ensemble | Deberta + Qwen |
| **15th** | - | ~0.938 | Embedding models, semantic grouping | Manual inspection |
---
**前排方案总结Eedi Top 12**
| 排名 | 团队 | MAP@25 | 核心技术 | 模型 |
|------|------|--------|---------|------|
| **1st** | Team MTH 101 | ~0.637 | Co-occurrence stats, Claude 3.5 Sonnet context | 72B + 32B ranker |
| **2nd** | Kazuhito Yonekawa et al. | ~0.636 | Multi-stage retrieve-and-rank | Qwen2.5-72B |
| **3rd** | waseda-pochi | ~0.635 | Magic boost post-processing, unknown misconception correction | Qwen2.5-32B |
| **4th** | - | ~0.634 | CoT features, grouped synthetic data | Qwen2.5-32B |
| **5th** | ebi-ktr | ~0.633 | Bi-encoder, listwise reranking | Qwen2.5-32B |
| **6th** | - | ~0.632 | QLoRA fine-tuning, ensemble | Qwen2.5-14B |
| **7th (Private) / 2nd (Public)** | terekaerumasahmet | ~0.631 | Multi-loss, soft labels | Qwen2.5-32B |
| **8th** | - | ~0.630 | Multi-stage retrieval, listwise reranking | Qwen2.5-32B |
| **9th (Private) / 7th (Public)** | - | ~0.629 | QLoRA fine-tuning | Qwen2.5-14B |
| **10th** | - | ~0.628 | Synthetic data, knowledge distillation | Qwen2.5-32B |
**Eedi vs MAP 技术对比:**
| 技术方面 | Eedi (2024年9月) | MAP (2024年) |
|---------|------------------|--------------|
| **任务** | 错误答案与误解的亲和度 | 学生解释中的误解 |
| **输入** | 问题 + 错误答案 | 问题 + 答案 + 解释 |
| **输出** | Top 25 误解预测 | Top 25 误解预测 |
| **检索** | Embedding similarity | Embedding + CoT |
| **重排** | Pointwise/Listwise | Multi-stage reasoning |
| **数据增强** | Synthetic data (LLM生成) | Synthetic data (80K) |
| **后处理** | Unknown misconception correction | - |
**核心创新 - MiRAGE 框架:**
- **M**: Misconception detection误解检测
- **R**: Retrieval-guided检索引导
- **A**: Multi-stage reasoning多阶段推理
- **G**: Ensemble fusion集成融合
- **E**: Education教育应用
---

View File

@@ -0,0 +1,593 @@
# AMP®-Parkinson's Disease Progression Prediction (2023)
## Competition Brief
**竞赛基本信息**
- **主办方**: AMP (Accelerating Medicines Partnership)
- **时间**: 2023年
- **类型**: 表格数据/医疗预测
- **数据规模**: 小样本数据集
- **评价目标**: SMAPE (Symmetric Mean Absolute Percentage Error)
**任务描述**
预测帕金森病患者的疾病进展情况。使用蛋白质和肽段数据(通过质谱测量脑脊液样本)来预测患者未来的 MDS-UPDRS 评分。
**数据特点**
- **蛋白质数据**: 227个蛋白质特征
- **肽段数据**: 来自多个质谱实验
- **时间序列**: 每个患者有多次访问记录
- **样本量**: 相对较小(小样本竞赛)
- **目标变量**: MDS-UPDRS 评分的进展
**评价指标**
SMAPE (Symmetric Mean Absolute Percentage Error)
- 对称性平均绝对百分比误差
- 范围 [0, 200],越小越好
- 对异常值相对鲁棒
---
## Top Solutions Analysis
### 1st Place - Connecting Dotts (Dmitry Gordeev et al.)
**核心策略**
- **模型组合**: LightGBM + Neural Network 的简单平均
- **特征工程**: 精心设计的蛋白质和肽段聚合特征
- **数据处理**: 针对神经网络的标准化和二值化
**关键技术细节**
1. **特征工程**
- 蛋白质和肽段的聚合统计量(均值、中位数、标准差)
- 时间序列特征的构造
- 蛋白质-肽段关系特征的提取
2. **模型架构**
- **LightGBM**: 梯度提升树模型
- **Neural Network**: 深度学习模型
- **集成策略**: 简单平均
3. **数据预处理**
- NN专用预处理: 特征缩放
- 特征二值化处理
- 缺失值处理策略
**代码要点**
```python
# 模型集成示例
final_prediction = (lgb_pred + nn_pred) / 2
```
### 2nd Place - No Luck, All Skill
**核心策略**
- 发布时间: 2023年6月19日
- 强调特征工程的重要性
- 多模型集成策略
**关键特征**
- 详细的特征工程流程
- 模型融合技术
- 验证策略设计
### 3rd Place - Hajime Tamura
**核心策略**
- 发布时间: 2023年5月19日
- **分组策略**: 将数据分成两组分别优化
- 简洁的解决方案(三个主要函数)
**关键创新**
- 数据分组优化
- 针对性模型训练
- 简化流程提升效率
### 4th/5th Place - Ambrosm (#5: Find the Control Group)
**核心策略**
- 发布时间: 2023年5月18日
- **控制组识别**: 关键创新点
- 利用对照组信息改进预测
**关键洞察**
- 识别并分离控制组样本
- 针对不同组别使用不同策略
- 提升模型区分度
### 9th Place - Makotu
**核心策略**
- 发布时间: 2023年5月18日
- 详细的特征工程和模型调优
### 13th Place - FNOA
**技术要点**
- 中等排名的稳定方案
- 实用的特征工程方法
### 43rd Place - Wojciech Victor Fulmyk (Top 3% Silver)
**重要发现**
- **XGBoost 和 LightGBM 表现不佳**
- 强调传统树模型在这个数据集上的局限性
- 探索其他模型方向
**技术要点**
```python
# 他们的发现表明传统 GBDT 可能不是最佳选择
# 需要考虑其他模型或更复杂的特征工程
```
### 89th Place - Giba (Non-Leaky Solution)
**核心策略**
- 强调无数据泄露的干净方案
- 可复现的验证策略
---
## Common Techniques Across Solutions
### 1. Feature Engineering Patterns
**蛋白质/肽段聚合特征**
```python
# 时间聚合
protein_stats = train.groupby('patient_id')['protein'].agg([
'mean', 'median', 'std', 'min', 'max'
])
# 肽段聚合
peptide_stats = train.groupby('patient_id')['peptide'].agg([
'mean', 'count', 'nunique'
])
```
**时间序列特征**
- 访问间隔时间
- 进展速度估计
- 基线和随访差异
**蛋白质-肽段关系**
- 蛋白质包含的肽数量
- 肽段来源的蛋白质信息
### 2. Model Selection Insights
**成功模型**
- LightGBM (部分方案)
- Neural Networks / MLP
- 集成方法
**需要谨慎的模型**
- XGBoost (43rd方案指出效果不佳)
- 纯线性模型
- 单一模型(推荐集成)
### 3. Validation Strategies
**关键原则**
- 避免患者级别的数据泄露
- 时间基础的分割
- 分组交叉验证
```python
from sklearn.model_selection import GroupKFold
gkf = GroupKFold(n_splits=5)
for train_idx, val_idx in gkf.split(X, y, groups=patient_ids):
# 训练和验证
```
### 4. Data Leakage Prevention
**常见陷阱**
- 同一患者的多次访问分散在训练/验证集
- 未来信息泄露到训练集
- 蛋白质/肽段测试集信息泄露
**预防措施**
- 严格的患者级别分割
- 时间有序分割
- 仔细的特征构造审计
---
## Code Templates
### Basic Feature Engineering
```python
import pandas as pd
import numpy as np
def create_protein_features(train_proteins, test_proteins):
"""创建蛋白质聚合特征"""
def process(df):
stats = df.groupby('patient_id')['NPX'].agg([
('protein_mean', 'mean'),
('protein_std', 'std'),
('protein_min', 'min'),
('protein_max', 'max')
]).reset_index()
return stats
train_stats = process(train_proteins)
test_stats = process(test_proteins)
return train_stats, test_stats
def create_peptide_features(train_peptides, test_peptides):
"""创建肽段聚合特征"""
def process(df):
stats = df.groupby('patient_id')['PeptideAbundance'].agg([
('peptide_mean', 'mean'),
('peptide_std', 'std'),
('peptide_count', 'count')
]).reset_index()
return stats
train_stats = process(train_peptides)
test_stats = process(test_peptides)
return train_stats, test_stats
def create_time_features(train_clinical, test_clinical):
"""创建时间序列特征"""
def process(df):
df = df.copy()
df['visit_month'] = df['visit_month'].astype(int)
df['pred_month'] = df['visit_month'] + df['updrs_test_month']
# 计算自基线以来的时间
df['months_since_baseline'] = df.groupby('patient_id')['visit_month'].transform(lambda x: x - x.min())
return df
return process(train_clinical), process(test_clinical)
```
### Model Training Template
```python
import lightgbm as lgb
from sklearn.model_selection import GroupKFold
from sklearn.metrics import mean_absolute_error
def smape(y_true, y_pred):
"""SMAPE 评估指标"""
return 100 * np.mean(2 * np.abs(y_pred - y_true) / (np.abs(y_true) + np.abs(y_pred) + 1e-8))
def train_lightgbm(X_train, y_train, groups, params=None):
"""训练 LightGBM 模型"""
if params is None:
params = {
'objective': 'regression',
'metric': 'mae',
'learning_rate': 0.01,
'num_leaves': 31,
'max_depth': -1,
'feature_fraction': 0.8,
'bagging_fraction': 0.8,
'bagging_freq': 5,
'verbose': -1
}
gkf = GroupKFold(n_splits=5)
models = []
scores = []
for train_idx, val_idx in gkf.split(X_train, y_train, groups=groups):
X_tr, X_val = X_train.iloc[train_idx], X_train.iloc[val_idx]
y_tr, y_val = y_train.iloc[train_idx], y_train.iloc[val_idx]
train_data = lgb.Dataset(X_tr, label=y_tr)
val_data = lgb.Dataset(X_val, label=y_val, reference=train_data)
model = lgb.train(
params,
train_data,
num_boost_round=10000,
valid_sets=[train_data, val_data],
callbacks=[lgb.early_stopping(100), lgb.log_evaluation(0)]
)
pred = model.predict(X_val)
score = smape(y_val, pred)
models.append(model)
scores.append(score)
print(f'Average SMAPE: {np.mean(scores):.2f}')
return models, scores
# 使用示例
# models, scores = train_lightgbm(X_train, y_train, patient_ids)
```
### Neural Network Template
```python
import tensorflow as tf
from sklearn.preprocessing import StandardScaler
def create_nn_model(input_dim, hidden_units=[256, 128, 64]):
"""创建神经网络模型"""
model = tf.keras.Sequential([
tf.keras.layers.Input(shape=(input_dim,)),
])
for units in hidden_units:
model.add(tf.keras.layers.Dense(
units,
activation='relu',
kernel_regularizer=tf.keras.regularizers.l2(0.01)
))
model.add(tf.keras.layers.Dropout(0.3))
model.add(tf.keras.layers.BatchNormalization())
model.add(tf.keras.layers.Dense(1, activation='linear'))
model.compile(
optimizer=tf.keras.optimizers.Adam(learning_rate=0.001),
loss='mae',
metrics=['mae']
)
return model
def train_nn(X_train, y_train, groups, epochs=100, batch_size=32):
"""训练神经网络"""
# 标准化
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
gkf = GroupKFold(n_splits=5)
models = []
scores = []
for train_idx, val_idx in gkf.split(X_train_scaled, y_train, groups=groups):
X_tr, X_val = X_train_scaled[train_idx], X_train_scaled[val_idx]
y_tr, y_val = y_train.iloc[train_idx], y_train.iloc[val_idx]
model = create_nn_model(X_train.shape[1])
early_stop = tf.keras.callbacks.EarlyStopping(
monitor='val_loss',
patience=10,
restore_best_weights=True
)
history = model.fit(
X_tr, y_tr,
validation_data=(X_val, y_val),
epochs=epochs,
batch_size=batch_size,
callbacks=[early_stop],
verbose=0
)
pred = model.predict(X_val).flatten()
score = smape(y_val, pred)
models.append((model, scaler))
scores.append(score)
print(f'Average SMAPE: {np.mean(scores):.2f}')
return models, scores
```
### Ensemble Template
```python
def ensemble_predictions(lgb_models, nn_models, X_test):
"""集成多个模型的预测"""
# LightGBM 预测
lgb_preds = np.mean([model.predict(X_test) for model in lgb_models], axis=0)
# NN 预测(需要标准化)
_, scaler = nn_models[0]
X_test_scaled = scaler.transform(X_test)
nn_preds = np.mean([
model.predict(X_test_scaled).flatten()
for model, _ in nn_models
], axis=0)
# 简单平均
final_pred = (lgb_preds + nn_preds) / 2
return final_pred
```
---
## Best Practices
### 1. Data Understanding
**蛋白质数据特性**
- 227个蛋白质可能来自不同通路
- 部分蛋白质可能高度相关
- 需要探索蛋白质-疾病关系
**肽段数据特性**
- 肽数量远大于蛋白质数
- 多个肽段可能来自同一蛋白质
- 肽段丰度需要归一化
**临床数据特性**
- MDS-UPDRS 评分范围 0-260
- 不同子评分(第一部分到第四部分)
- 访问时间间隔不均匀
### 2. Feature Engineering Guidelines
**DOs**
- ✅ 创建患者级别的聚合特征
- ✅ 利用时间序列信息
- ✅ 探索蛋白质-肽段关系
- ✅ 考虑蛋白质生物学意义
- ✅ 使用领域知识构造特征
**DON'Ts**
- ❌ 在测试集上计算统计量
- ❌ 混合不同患者的未来信息
- ❌ 忽略数据的时间顺序
- ❌ 过度使用目标编码(容易泄露)
### 3. Model Selection Strategy
**推荐流程**
1. 从简单模型开始(线性模型、决策树)
2. 尝试 LightGBM部分方案有效
3. 探索神经网络1st方案使用
4. 集成多个模型
5. 针对性调整超参数
**模型选择考虑**
- 数据量小 → 简单模型或强正则化
- 特征多 → 特征选择或降维
- 时序特性 → 考虑时间序列模型
- 集成收益 → 尝试模型融合
### 4. Validation Strategy
**推荐方法**
```python
# 患者级别的 Group K-Fold
from sklearn.model_selection import GroupKFold
gkf = GroupKFold(n_splits=5)
for fold, (train_idx, val_idx) in enumerate(gkf.split(X, y, groups=patient_ids)):
print(f'Fold {fold + 1}')
# 训练和验证
```
**时间序列分割**
```python
from sklearn.model_selection import TimeSeriesSplit
tscv = TimeSeriesSplit(n_splits=5)
for fold, (train_idx, val_idx) in enumerate(tscv.split(X)):
# 确保验证集在时间上晚于训练集
```
### 5. Common Pitfalls
**数据泄露**
- ❌ 将同一患者的多次访问分散到训练和验证集
- ❌ 在分割前计算全局统计量
- ❌ 使用未来信息预测过去
**过拟合**
- ❌ 特征过多而样本过少
- ❌ 过度调参导致验证集泄露
- ❌ 复杂模型在小数据集上
**评估偏差**
- ❌ 使用错误的评估指标
- ❌ 忽略 SMAPE 的对称性
- ❌ 不关注预测的分布特性
### 6. Domain Knowledge Integration
**帕金森病相关**
- MDS-UPDRS 评分的临床意义
- 蛋白质标志物的生物学作用
- 疾病进展的非线性特性
**蛋白质组学**
- 质谱数据的技术变异
- 蛋白质-肽段的定量关系
- 缺失值的含义
### 7. Hyperparameter Tuning
**LightGBM 关键参数**
```python
params = {
'learning_rate': 0.01, # 降低学习率
'num_leaves': 31, # 控制复杂度
'max_depth': -1, # 不限制深度
'min_data_in_leaf': 20, # 小数据集增大此值
'feature_fraction': 0.8, # 特征采样
'bagging_fraction': 0.8, # 数据采样
'bagging_freq': 5,
'lambda_l1': 0.1, # L1 正则化
'lambda_l2': 0.1, # L2 正则化
}
```
**神经网络关键参数**
```python
# 小数据集推荐
hidden_units = [128, 64, 32] # 减少层数和单元数
dropout_rate = 0.3 # 增加 dropout
l2_reg = 0.01 # L2 正则化
learning_rate = 0.001 # 适中学习率
batch_size = 32 # 小批量
```
---
## Key Takeaways
1. **小样本竞赛特点**
- 特征工程比模型复杂度更重要
- 避免过拟合是关键
- 简单模型集成可能优于复杂单模型
2. **医疗数据特殊性**
- 需要理解领域知识
- 数据泄露风险更高
- 评估指标的临床意义
3. **成功的共同点**
- 仔细的特征工程
- 严格的验证策略
- 模型集成
- 避免数据泄露
4. **需要注意的陷阱**
- XGBoost/LightGBM 不是万能的43rd方案发现
- 数据泄露容易但难以发现
- 小样本的过拟合风险
5. **推荐的学习路径**
- 从 1st, 2nd, 3rd 方案学习顶级思路
- 从 5th, 9th 方案学习实用技巧
- 从 43rd 方案学习失败经验
- 综合多个方案形成自己的方法
---
## Resources
### Official Writeups
- [1st Place Solution - Connecting Dotts](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/connecting-dotts-1st-place-solution)
- [2nd Place Solution - No Luck, All Skill](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/no-luck-all-skill-2nd-place-solution)
- [3rd Place Solution - Hajime Tamura](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/hajime-tamura-3rd-place-solution)
- [5th Place Solution - Ambrosm](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/ambrosm-5-find-the-control-group)
- [9th Place Solution - Makotu](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/makotu-9th-place-solution)
- [13th Place Solution - FNOA](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/fnoa-13th-place-solution)
- [43rd Place Solution - Wojciech Victor Fulmyk](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/wojciech-victor-fulmyk-43rd-top-3-silver-medal-sol)
- [89th Place Solution - Giba (Non-Leaky)](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/writeups/giba-top-89-non-leaky-solution)
### External Resources
- [H2O.ai Blog: Navigating the Parkinson's Disease Prediction Challenge with AI](https://h2o.ai/blog/2023/winners-insight-navigating-the-parkinsons-disease-prediction-challenge-with-ai/)
- [中文复现: 小样本比赛也能有稳定区分度](https://zhuanlan.zhihu.com/p/669527953)
### Competition Pages
- [Main Competition Page](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction)
- [Data Description](https://www.kaggle.com/competitions/amp-parkinsons-disease-progression-prediction/data)
- [Discussion Forum](https://www.kaggle.com/c/amp-parkinsons-disease-progression-prediction/discussion)
### Code Notebooks
- [LightGBM Starter with Added Features](https://www.kaggle.com/code/sijovm/lightgbm-starter-with-added-features)
- [XGB Baseline with Added Features](https://www.kaggle.com/code/sijovm/xgb-baseline-with-added-features)
- [AMP® - PDPP EDA + TF Model](https://www.kaggle.com/code/callmewenhao/amp-pdpp-eda-tf-model)
- [AMP® - PDPP EDA](https://www.kaggle.com/code/gunesevitan/amp-pdpp-eda)