Implement plain KNN classifier and testing infrastructure

- Add plain KNN implementation with JSONL data processing
- Create Docker deployment setup with python:3.13-slim base
- Add comprehensive OJ-style testing system with accuracy validation
- Update README with detailed scoring mechanism explanation
- Add run.sh script following competition manual requirements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-05 21:11:22 +08:00
parent 136583715e
commit d58adda9ab
8 changed files with 505 additions and 147 deletions

View File

@@ -8,3 +8,25 @@ knn算法关键是使用一个距离函数来计算样本之间的距离
全同态加密计划使用TFHE-rs, 简化后流程无须交互,仅在单个程序内模拟即可。
评分详情见[参赛手册](./manual.md)
## 评分机制
### 正确率计算
- 算法需要返回10个最近邻向量的索引
- 正确率 = 正确的索引数量 / 10
- 例如10个结果中有9个正确正确率 = 90%
### 评分规则
- **门槛要求**正确率必须≥90%即10个结果中至少9个正确
- **排名依据**:达到门槛后,按总耗时排名(越快越好)
- **淘汰机制**:正确率<90%直接得0分
### "正确"的定义
- 比赛方有标准答案真实的10个最近邻
- 算法结果与标准答案比较
- 顺序不重要,只要索引正确即可
### 数据格式
- 训练数据JSONL格式每行包含一个query向量和data数组
- 输出格式:`{"answer": [索引1, 索引2, ..., 索引10]}`
- 索引从1开始编号