Files
hfe_knn/README.md
sangge d58adda9ab 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>
2025-07-05 21:11:22 +08:00

33 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# hfe_knn
全同态加密下的KNN算法实现
knn算法关键是使用一个距离函数来计算样本之间的距离常用的距离函数有欧氏距离、曼哈顿距离等。
计算距离可以在全密文下实现。
主要是寻找一个全同态加密的比较大小方案
全同态加密计划使用TFHE-rs, 简化后流程无须交互,仅在单个程序内模拟即可。
评分详情见[参赛手册](./manual.md)
## 评分机制
### 正确率计算
- 算法需要返回10个最近邻向量的索引
- 正确率 = 正确的索引数量 / 10
- 例如10个结果中有9个正确正确率 = 90%
### 评分规则
- **门槛要求**正确率必须≥90%即10个结果中至少9个正确
- **排名依据**:达到门槛后,按总耗时排名(越快越好)
- **淘汰机制**:正确率<90%直接得0分
### "正确"的定义
- 比赛方有标准答案真实的10个最近邻
- 算法结果与标准答案比较
- 顺序不重要,只要索引正确即可
### 数据格式
- 训练数据JSONL格式每行包含一个query向量和data数组
- 输出格式:`{"answer": [索引1, 索引2, ..., 索引10]}`
- 索引从1开始编号