refactor: 重组项目目录结构
以讲义内容为骨架迁移到标准目录格式: - officefile/ 主内容(12章 + 附录 + CC4SI补充) - dofile/ 代码示例(11个Python脚本) - data/ 图片资源 - output/ 生成输出(忽略) - Archive/ 归档旧目录(忽略) - .claude/skills/ 保留markdown-to-docx工具链 - .pandoc/ 保留CSL和本地化配置 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,798 @@
|
||||
# 05.3 技术迭代与持久知识
|
||||
|
||||
## 核心问题
|
||||
|
||||
> 在快速变化的技术环境中,哪些知识会持久?
|
||||
> 如何判断新技术值得投入时间学习?
|
||||
> 如何建立可持续的知识更新机制?
|
||||
|
||||
---
|
||||
|
||||
## 概念讲解
|
||||
|
||||
### 技术变化的层次
|
||||
|
||||
理解技术变化的本质,帮助区分短暂潮流和持久价值:
|
||||
|
||||
```
|
||||
技术变化的四个层次
|
||||
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ │
|
||||
│ Level 4: 应用层 (Application) 变化最快 │
|
||||
│ ─────────────────────────────────────────────────── │
|
||||
│ • 具体工具和框架 (e.g., QGIS 3.x → 4.x) │
|
||||
│ • API和语法细节 │
|
||||
│ • 特定库的使用模式 │
|
||||
│ 半衰期: 1-2年 │
|
||||
│ │
|
||||
│ Level 3: 方法层 (Methodology) │
|
||||
│ ─────────────────────────────────────────────────── │
|
||||
│ • 空间分析方法 (e.g., Circuit theory, Least-cost path) │
|
||||
│ • 工作流设计模式 │
|
||||
│ • 数据处理策略 │
|
||||
│ 半衰期: 5-10年 │
|
||||
│ │
|
||||
│ Level 2: 原理层 (Principle) │
|
||||
│ ─────────────────────────────────────────────────── │
|
||||
│ • 空间统计原理 │
|
||||
│ • 图论和网络分析 │
|
||||
│ • 优化理论 │
|
||||
│ 半衰期: 20-50年 │
|
||||
│ │
|
||||
│ Level 1: 思维层 (Thinking) 变化最慢 │
|
||||
│ ─────────────────────────────────────────────────── │
|
||||
│ • 空间思维方式 │
|
||||
│ • 系统思维 │
|
||||
│ • 批判性思维 │
|
||||
│ 半衰期: 基本不变 │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
|
||||
学习策略:向上投资
|
||||
更多时间投入在原理层和思维层
|
||||
应用层的知识随用随学
|
||||
```
|
||||
|
||||
### 什么在变,什么不变
|
||||
|
||||
| 变化的 | 相对稳定的 | 持久不变的 |
|
||||
|-------|-----------|-----------|
|
||||
| 工具版本 | 空间分析方法 | 空间问题本质 |
|
||||
| API设计 | 数据结构设计 | 几何公理 |
|
||||
| 算法实现 | 架构模式 | 数学原理 |
|
||||
| 命令语法 | 工作流逻辑 | 项目目标 |
|
||||
| 框架生态 | 问题分解方法 | 人类需求 |
|
||||
| 数据格式 | 验证策略 | 质量标准 |
|
||||
|
||||
### 持久知识框架
|
||||
|
||||
```python
|
||||
"""
|
||||
持久知识管理系统
|
||||
"""
|
||||
from typing import Dict, List, Set, Optional
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
class KnowledgeLevel(Enum):
|
||||
"""知识层次"""
|
||||
APPLICATION = "application" # 应用层:快速变化
|
||||
METHODOLOGY = "methodology" # 方法层:中速变化
|
||||
PRINCIPLE = "principle" # 原理层:慢速变化
|
||||
THINKING = "thinking" # 思维层:基本不变
|
||||
|
||||
class KnowledgeStatus(Enum):
|
||||
"""知识状态"""
|
||||
NEW = "new" # 新知识
|
||||
LEARNING = "learning" # 学习中
|
||||
MASTERED = "mastered" # 已掌握
|
||||
OUTDATED = "outdated" # 已过时
|
||||
|
||||
@dataclass
|
||||
class KnowledgeItem:
|
||||
"""知识条目"""
|
||||
name: str
|
||||
level: KnowledgeLevel
|
||||
status: KnowledgeStatus
|
||||
related_principles: List[str] # 关联的原理层知识
|
||||
practical_applications: List[str] # 实际应用场景
|
||||
last_reviewed: str # ISO日期
|
||||
confidence: float # 0-1
|
||||
|
||||
class KnowledgeSystem:
|
||||
"""个人知识系统"""
|
||||
|
||||
def __init__(self):
|
||||
self.items: Dict[str, KnowledgeItem] = {}
|
||||
self.principles: Set[str] = set()
|
||||
self.connections: Dict[str, List[str]] = {} # 知识关联图
|
||||
|
||||
def add_principle(self, principle: str, description: str):
|
||||
"""添加核心原理(持久知识)"""
|
||||
self.principles.add(principle)
|
||||
print(f"添加核心原理: {principle}")
|
||||
|
||||
def learn_technology(self, tech_name: str,
|
||||
related_principles: List[str],
|
||||
applications: List[str]):
|
||||
"""
|
||||
学习新技术时,关联到原理
|
||||
|
||||
这样即使技术过时,原理知识仍然有用
|
||||
"""
|
||||
# 检查关联的原理是否都已记录
|
||||
for p in related_principles:
|
||||
if p not in self.principles:
|
||||
print(f"警告: 关联原理 '{p}' 不在知识库中")
|
||||
|
||||
# 添加知识条目
|
||||
self.items[tech_name] = KnowledgeItem(
|
||||
name=tech_name,
|
||||
level=self._guess_level(tech_name),
|
||||
status=KnowledgeStatus.LEARNING,
|
||||
related_principles=related_principles,
|
||||
practical_applications=applications,
|
||||
last_reviewed="",
|
||||
confidence=0.5
|
||||
)
|
||||
|
||||
# 建立关联
|
||||
self._build_connections(tech_name, related_principles)
|
||||
|
||||
def review_knowledge(self, tech_name: str, current_value: int):
|
||||
"""
|
||||
定期回顾知识
|
||||
|
||||
current_value: 0-10,该技术当前的价值评分
|
||||
"""
|
||||
if tech_name not in self.items:
|
||||
return
|
||||
|
||||
item = self.items[tech_name]
|
||||
|
||||
# 如果评分低,标记为过时
|
||||
if current_value < 3:
|
||||
item.status = KnowledgeStatus.OUTDATED
|
||||
print(f"{tech_name} 已过时,但原理知识保留:")
|
||||
for p in item.related_principles:
|
||||
print(f" - {p}")
|
||||
else:
|
||||
item.status = KnowledgeStatus.MASTERED
|
||||
item.confidence = min(current_value / 10, 1.0)
|
||||
|
||||
item.last_reviewed = self._get_date()
|
||||
|
||||
def get_learning_priority(self) -> List[str]:
|
||||
"""
|
||||
获取学习优先级
|
||||
|
||||
策略:优先学习那些
|
||||
1. 关联多个重要原理的技术
|
||||
2. 当前价值高但尚未掌握的
|
||||
"""
|
||||
priorities = []
|
||||
|
||||
for name, item in self.items.items():
|
||||
if item.status == KnowledgeStatus.OUTDATED:
|
||||
continue
|
||||
|
||||
# 计算优先级分数
|
||||
score = 0
|
||||
|
||||
# 原理覆盖度
|
||||
score += len(item.related_principles) * 10
|
||||
|
||||
# 当前价值
|
||||
if item.status == KnowledgeStatus.NEW:
|
||||
score += 20
|
||||
|
||||
# 掌握度(越低越需要学习)
|
||||
score += (1 - item.confidence) * 30
|
||||
|
||||
priorities.append((name, score))
|
||||
|
||||
priorities.sort(key=lambda x: x[1], reverse=True)
|
||||
return [p[0] for p in priorities]
|
||||
|
||||
def _guess_level(self, name: str) -> KnowledgeLevel:
|
||||
"""根据名称猜测知识层次"""
|
||||
# 工具、框架通常是应用层
|
||||
tool_keywords = ['qgis', 'arcgis', 'python', 'library', 'api']
|
||||
if any(kw in name.lower() for kw in tool_keywords):
|
||||
return KnowledgeLevel.APPLICATION
|
||||
|
||||
# 方法类词汇通常是方法层
|
||||
method_keywords = ['analysis', 'method', 'approach', 'workflow']
|
||||
if any(kw in name.lower() for kw in method_keywords):
|
||||
return KnowledgeLevel.METHODOLOGY
|
||||
|
||||
return KnowledgeLevel.PRINCIPLE
|
||||
|
||||
def _build_connections(self, tech: str, principles: List[str]):
|
||||
"""建立知识关联"""
|
||||
self.connections[tech] = principles
|
||||
|
||||
def _get_date(self) -> str:
|
||||
"""获取当前日期"""
|
||||
from datetime import datetime
|
||||
return datetime.now().isoformat()
|
||||
|
||||
def get_principle_coverage(self) -> Dict[str, List[str]]:
|
||||
"""
|
||||
获取原理覆盖情况
|
||||
|
||||
返回:每个原理相关的技术
|
||||
"""
|
||||
coverage = {p: [] for p in self.principles}
|
||||
|
||||
for tech, principles in self.connections.items():
|
||||
for p in principles:
|
||||
if p in coverage:
|
||||
coverage[p].append(tech)
|
||||
|
||||
return coverage
|
||||
|
||||
# === 示例:空间AI知识体系 ===
|
||||
|
||||
def build_spatial_ai_knowledge_system():
|
||||
"""构建空间AI知识体系"""
|
||||
ks = KnowledgeSystem()
|
||||
|
||||
# 添加核心原理(持久知识)
|
||||
core_principles = [
|
||||
("空间自相关", "空间上相近的事物更相似"),
|
||||
("尺度效应", "空间模式随观测尺度变化"),
|
||||
("拓扑关系", "空间对象之间的邻接、包含等关系"),
|
||||
("距离衰减", "相互作用随距离减弱"),
|
||||
("最小阻力路径", "考虑阻力的最优路径"),
|
||||
("源-汇动态", "资源在源和汇之间的流动"),
|
||||
("景观格局", "空间配置对生态过程的影响"),
|
||||
]
|
||||
|
||||
for principle, description in core_principles:
|
||||
ks.add_principle(principle, description)
|
||||
|
||||
# 学习具体技术(关联到原理)
|
||||
technologies = [
|
||||
("Morpheus (软件)", ["景观格局"], ["景观指数计算"]),
|
||||
("Circuitscape", ["最小阻力路径", "源-汇动态"], ["生态连通性分析"]),
|
||||
("Linkage Mapper", ["最小阻力路径"], ["廊道识别"]),
|
||||
("Geoda", ["空间自相关"], ["空间自相关分析"]),
|
||||
("QGIS Processing", [], ["空间分析自动化"]),
|
||||
]
|
||||
|
||||
for tech, principles, apps in technologies:
|
||||
ks.learn_technology(tech, principles, apps)
|
||||
|
||||
return ks
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("=== 持久知识管理系统 ===\n")
|
||||
|
||||
ks = build_spatial_ai_knowledge_system()
|
||||
|
||||
print("\n--- 原理覆盖情况 ---")
|
||||
coverage = ks.get_principle_coverage()
|
||||
for principle, techs in coverage.items():
|
||||
if techs:
|
||||
print(f"\n{principle}:")
|
||||
for tech in techs:
|
||||
print(f" - {tech}")
|
||||
else:
|
||||
print(f"\n{principle}: (尚无相关技术)")
|
||||
|
||||
print("\n--- 学习优先级 ---")
|
||||
priorities = ks.get_learning_priority()
|
||||
for i, tech in enumerate(priorities[:5], 1):
|
||||
print(f"{i}. {tech}")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 设计原理
|
||||
|
||||
### 技术评估框架
|
||||
|
||||
在决定是否学习某项新技术时,使用系统化的评估:
|
||||
|
||||
```python
|
||||
"""
|
||||
技术价值评估框架
|
||||
"""
|
||||
from typing import Dict, List, Callable
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class TechAssessment:
|
||||
"""技术评估结果"""
|
||||
name: str
|
||||
total_score: float
|
||||
dimension_scores: Dict[str, float]
|
||||
recommendation: str
|
||||
reasoning: List[str]
|
||||
|
||||
class TechnologyEvaluator:
|
||||
"""技术评估器"""
|
||||
|
||||
def __init__(self):
|
||||
self.dimensions = {
|
||||
'principle_value': 0.3, # 原理价值:是否关联深层原理
|
||||
'applicability': 0.25, # 适用性:应用范围广度
|
||||
'longevity': 0.2, # 持久性:预计技术寿命
|
||||
'community': 0.15, # 社区:生态系统活跃度
|
||||
'learning_cost': 0.1, # 学习成本(负向)
|
||||
}
|
||||
|
||||
def evaluate(self, tech_name: str,
|
||||
principle_links: List[str],
|
||||
applications: List[str],
|
||||
maturity: str,
|
||||
community_size: str,
|
||||
estimated_hours: int) -> TechAssessment:
|
||||
|
||||
scores = {}
|
||||
|
||||
# 1. 原理价值
|
||||
scores['principle_value'] = min(len(principle_links) * 0.2, 1.0)
|
||||
|
||||
# 2. 适用性
|
||||
scores['applicability'] = min(len(applications) * 0.15, 1.0)
|
||||
|
||||
# 3. 持久性
|
||||
longevity_scores = {
|
||||
'concept': 1.0,
|
||||
'standard': 0.8,
|
||||
'emerging': 0.5,
|
||||
'experimental': 0.2
|
||||
}
|
||||
scores['longevity'] = longevity_scores.get(maturity, 0.5)
|
||||
|
||||
# 4. 社区
|
||||
community_scores = {
|
||||
'large': 1.0,
|
||||
'medium': 0.7,
|
||||
'small': 0.4,
|
||||
'tiny': 0.2
|
||||
}
|
||||
scores['community'] = community_scores.get(community_size, 0.5)
|
||||
|
||||
# 5. 学习成本(负向)
|
||||
scores['learning_cost'] = max(0, 1 - estimated_hours / 100)
|
||||
|
||||
# 计算加权总分
|
||||
total = sum(
|
||||
scores[dim] * weight
|
||||
for dim, weight in self.dimensions.items()
|
||||
)
|
||||
|
||||
# 生成建议
|
||||
recommendation, reasoning = self._generate_recommendation(
|
||||
scores, total, estimated_hours
|
||||
)
|
||||
|
||||
return TechAssessment(
|
||||
name=tech_name,
|
||||
total_score=total,
|
||||
dimension_scores=scores,
|
||||
recommendation=recommendation,
|
||||
reasoning=reasoning
|
||||
)
|
||||
|
||||
def _generate_recommendation(self, scores: Dict, total: float,
|
||||
hours: int) -> tuple:
|
||||
"""生成建议"""
|
||||
reasoning = []
|
||||
|
||||
# 分析各维度
|
||||
if scores['principle_value'] < 0.3:
|
||||
reasoning.append("原理价值较低,可能只是工具层知识")
|
||||
elif scores['principle_value'] > 0.8:
|
||||
reasoning.append("关联多个核心原理,学习价值高")
|
||||
|
||||
if scores['longevity'] < 0.5:
|
||||
reasoning.append("技术成熟度低,可能快速变化")
|
||||
elif scores['longevity'] > 0.8:
|
||||
reasoning.append("技术相对稳定,知识可持久")
|
||||
|
||||
if hours > 50 and total < 0.6:
|
||||
reasoning.append(f"学习成本高({hours}h)但综合价值低")
|
||||
|
||||
# 总体建议
|
||||
if total > 0.7:
|
||||
rec = "强烈推荐学习"
|
||||
elif total > 0.5:
|
||||
rec = "值得学习"
|
||||
elif total > 0.3:
|
||||
rec = "按需学习"
|
||||
else:
|
||||
rec = "不推荐投入时间"
|
||||
|
||||
return rec, reasoning
|
||||
|
||||
# === 技术评估示例 ===
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("=== 技术价值评估 ===\n")
|
||||
|
||||
evaluator = TechnologyEvaluator()
|
||||
|
||||
technologies = [
|
||||
{
|
||||
'name': 'Spatial SQL (PostGIS)',
|
||||
'principles': ['拓扑关系', '空间查询', '集合操作'],
|
||||
'applications': ['数据管理', '空间分析', '服务提供'],
|
||||
'maturity': 'standard',
|
||||
'community': 'large',
|
||||
'hours': 40
|
||||
},
|
||||
{
|
||||
'name': '某新兴AI框架',
|
||||
'principles': ['深度学习'],
|
||||
'applications': ['图像识别'],
|
||||
'maturity': 'experimental',
|
||||
'community': 'small',
|
||||
'hours': 80
|
||||
},
|
||||
{
|
||||
'name': '景观格局分析理论',
|
||||
'principles': ['景观格局', '尺度效应', '空间异质性'],
|
||||
'applications': ['生态评价', '景观规划', '环境评估'],
|
||||
'maturity': 'concept',
|
||||
'community': 'medium',
|
||||
'hours': 30
|
||||
},
|
||||
]
|
||||
|
||||
for tech in technologies:
|
||||
result = evaluator.evaluate(**tech)
|
||||
print(f"\n{result.name}")
|
||||
print(f"总分: {result.total_score:.2f}")
|
||||
print(f"建议: {result.recommendation}")
|
||||
print("各维度:")
|
||||
for dim, score in result.dimension_scores.items():
|
||||
bar = "█" * int(score * 20)
|
||||
print(f" {dim}: {bar} {score:.2f}")
|
||||
print("理由:")
|
||||
for r in result.reasoning:
|
||||
print(f" - {r}")
|
||||
```
|
||||
|
||||
### 持续学习策略
|
||||
|
||||
```
|
||||
持续学习的三角模型
|
||||
|
||||
┌─────────────────┐
|
||||
│ 主动学习 │
|
||||
│ - 探索新领域 │
|
||||
│ - 预测趋势 │
|
||||
└────────┬────────┘
|
||||
│
|
||||
│
|
||||
┌─────────────────┼─────────────────┐
|
||||
│ │ │
|
||||
┌──────┴──────┐ ┌─────┴─────┐ ┌─────┴─────┐
|
||||
│ 响应式学习 │ │ 反思整合 │ │ 社区连接 │
|
||||
│ │ │ │ │ │
|
||||
│ - 解决问题 │ │ - 定期回顾│ │ - 参与讨论│
|
||||
│ - 查漏补缺 │ │ - 写笔记 │ │ - 分享知识│
|
||||
│ - 即时学习 │ │ - 建立连接│ │ - 获取反馈│
|
||||
└─────────────┘ └───────────┘ └───────────┘
|
||||
|
||||
各部分的实践方法:
|
||||
|
||||
1. 响应式学习
|
||||
- 遇到问题时记录下来
|
||||
- 快速查找解决方案
|
||||
- 事后总结为知识条目
|
||||
|
||||
2. 主动学习
|
||||
- 关注领域顶级会议/期刊
|
||||
- 订阅精选博客/通讯
|
||||
- 定期探索新技术
|
||||
|
||||
3. 反思整合
|
||||
- 每周/每月回顾
|
||||
- 更新知识图谱
|
||||
- 重写过时笔记
|
||||
|
||||
4. 社区连接
|
||||
- 加入专业社区
|
||||
- 参与开源项目
|
||||
- 组织学习小组
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 案例分析
|
||||
|
||||
### 案例1:从ArcGIS到QGIS的迁移
|
||||
|
||||
**背景**:GIS工具的变化,但原理知识保持不变。
|
||||
|
||||
```
|
||||
迁移时的知识对比:
|
||||
|
||||
ArcGIS (ArcPy) QGIS (PyQGIS)
|
||||
─────────────────────────────────────────────────
|
||||
arcpy.mp QgsProject
|
||||
│ ├── Map │ ├── QgsLayout
|
||||
│ └── Layer │ └── QgsMapLayer
|
||||
│
|
||||
arcpy.sa (Spatial Analyst) Processing algorithms
|
||||
│ ├── Raster calculator │ ├── QgsProcessingAlgorithm
|
||||
│ └── Zonal statistics │ └── QgsProcessingContext
|
||||
│
|
||||
ModelBuilder Graphical Modeler
|
||||
│ ├── Intermediate data │ ├── Input/Output
|
||||
│ └── Iterators │ └── Modeller algorithms
|
||||
|
||||
不变的核心知识:
|
||||
• 理解栅格和矢量数据结构
|
||||
• 理解投影和坐标系统
|
||||
• 理解空间分析的逻辑流程
|
||||
• 理解数据模型和拓扑关系
|
||||
|
||||
变化的部分:
|
||||
• API和类名
|
||||
• 具体操作语法
|
||||
• 界面操作方式
|
||||
|
||||
迁移策略:
|
||||
1. 用一个下午对照API文档做转换
|
||||
2. 建立常用操作的对照表
|
||||
3. 重点理解新工具的架构设计
|
||||
```
|
||||
|
||||
### 案例2:深度学习在遥感中的应用
|
||||
|
||||
**背景**:新技术快速迭代,但基础概念相对稳定。
|
||||
|
||||
```python
|
||||
"""
|
||||
深度学习技术栈的层次分析
|
||||
"""
|
||||
|
||||
# 短半衰期(1-2年)- 随用随学
|
||||
short_lived = [
|
||||
"特定模型架构 (e.g., U-Net变体)",
|
||||
"训练框架 (e.g., PyTorch vs TensorFlow)",
|
||||
"预处理工具",
|
||||
"特定数据集格式"
|
||||
]
|
||||
|
||||
# 中半衰期(5-10年)- 重点学习
|
||||
medium_lived = [
|
||||
"卷积操作原理",
|
||||
"迁移学习策略",
|
||||
"数据增强方法",
|
||||
"模型评估指标",
|
||||
"特征可视化技术"
|
||||
]
|
||||
|
||||
# 长半衰期(20+年)- 深入理解
|
||||
long_lived = [
|
||||
"梯度下降优化原理",
|
||||
"过拟合与正则化",
|
||||
"偏差-方差权衡",
|
||||
"交叉验证",
|
||||
"损失函数设计"
|
||||
]
|
||||
|
||||
# 空间AI特有的持久知识
|
||||
spatial_essentials = [
|
||||
"空间自相关及其对训练集的影响",
|
||||
"空间交叉验证(防止空间泄漏)",
|
||||
"尺度效应与感受野",
|
||||
"空间不确定性量化",
|
||||
"可解释性在空间决策中的重要性"
|
||||
]
|
||||
|
||||
print("深度学习在遥感中的知识层次\n")
|
||||
print("短期(随用随学):")
|
||||
for item in short_lived:
|
||||
print(f" - {item}")
|
||||
print("\n中期(重点学习):")
|
||||
for item in medium_lived:
|
||||
print(f" - {item}")
|
||||
print("\n长期(深入理解):")
|
||||
for item in long_lived:
|
||||
print(f" - {item}")
|
||||
print("\n空间AI核心:")
|
||||
for item in spatial_essentials:
|
||||
print(f" - {item}")
|
||||
```
|
||||
|
||||
### 案例3:个人知识更新机制
|
||||
|
||||
```python
|
||||
"""
|
||||
定期知识回顾机制
|
||||
"""
|
||||
from datetime import datetime, timedelta
|
||||
from typing import List, Dict
|
||||
|
||||
class LearningCalendar:
|
||||
"""学习日历"""
|
||||
|
||||
def __init__(self):
|
||||
self.review_queue = []
|
||||
self.last_review = {}
|
||||
|
||||
def schedule_review(self, topic: str, level: str, initial_days: int):
|
||||
"""
|
||||
安排复习
|
||||
|
||||
使用间隔重复策略
|
||||
"""
|
||||
schedule = {
|
||||
'new': [1, 3, 7, 14, 30], # 新知识:密集复习
|
||||
'stable': [30, 90, 180, 365], # 稳定知识:稀疏复习
|
||||
'archived': [365, 730] # 归档知识:年度检查
|
||||
}
|
||||
|
||||
for days in schedule.get(level, schedule['stable']):
|
||||
review_date = datetime.now() + timedelta(days=days)
|
||||
self.review_queue.append({
|
||||
'topic': topic,
|
||||
'date': review_date,
|
||||
'level': level
|
||||
})
|
||||
|
||||
def get_due_reviews(self) -> List[Dict]:
|
||||
"""获取到期的复习"""
|
||||
now = datetime.now()
|
||||
return [
|
||||
item for item in self.review_queue
|
||||
if item['date'] <= now
|
||||
]
|
||||
|
||||
def complete_review(self, topic: str, quality: int):
|
||||
"""
|
||||
完成复习
|
||||
|
||||
quality: 1-5,复习质量评分
|
||||
"""
|
||||
self.last_review[topic] = {
|
||||
'date': datetime.now(),
|
||||
'quality': quality
|
||||
}
|
||||
|
||||
# 根据质量调整下次复习时间
|
||||
if quality >= 4:
|
||||
# 掌握良好,延长时间间隔
|
||||
pass
|
||||
elif quality <= 2:
|
||||
# 掌握不好,重新安排密集复习
|
||||
pass
|
||||
|
||||
class KnowledgeJournal:
|
||||
"""知识日志"""
|
||||
|
||||
def __init__(self):
|
||||
self.entries = []
|
||||
|
||||
def log_learning(self, topic: str, what: str, why: str,
|
||||
how: str, connections: List[str]):
|
||||
"""
|
||||
记录学习
|
||||
|
||||
使用What-Why-How框架
|
||||
"""
|
||||
entry = {
|
||||
'date': datetime.now().isoformat(),
|
||||
'topic': topic,
|
||||
'what': what, # 学到了什么
|
||||
'why': why, # 为什么重要
|
||||
'how': how, # 如何应用
|
||||
'connections': connections, # 与已有知识的连接
|
||||
'questions': [] # 未解决的问题
|
||||
}
|
||||
self.entries.append(entry)
|
||||
|
||||
def log_question(self, topic: str, question: str):
|
||||
"""记录问题"""
|
||||
# 找到相关条目或创建新的
|
||||
for entry in self.entries:
|
||||
if entry['topic'] == topic:
|
||||
entry['questions'].append({
|
||||
'question': question,
|
||||
'date': datetime.now().isoformat()
|
||||
})
|
||||
return
|
||||
|
||||
def get_review_prompt(self, topic: str) -> str:
|
||||
"""生成复习提示"""
|
||||
for entry in self.entries:
|
||||
if entry['topic'] == topic:
|
||||
prompt = f"""
|
||||
复习主题: {topic}
|
||||
|
||||
学习内容:
|
||||
{entry['what']}
|
||||
|
||||
重要性:
|
||||
{entry['why']}
|
||||
|
||||
应用方式:
|
||||
{entry['how']}
|
||||
|
||||
关联知识:
|
||||
{', '.join(entry['connections'])}
|
||||
|
||||
未解决问题:
|
||||
{chr(10).join(q['question'] for q in entry['questions'])}
|
||||
|
||||
复习问题:
|
||||
1. 这个知识的核心是什么?
|
||||
2. 我在哪些场景中应用过它?
|
||||
3. 它与哪些其他知识相关?
|
||||
4. 我还有哪些不明白的地方?
|
||||
"""
|
||||
return prompt
|
||||
return f"未找到主题: {topic}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("=== 个人知识更新系统 ===\n")
|
||||
|
||||
calendar = LearningCalendar()
|
||||
journal = KnowledgeJournal()
|
||||
|
||||
# 示例:学习一个新技术
|
||||
journal.log_learning(
|
||||
topic="空间交叉验证",
|
||||
what="防止训练集和测试集空间自相关导致的模型过拟合",
|
||||
why="标准交叉验证假设样本独立,空间数据违反此假设",
|
||||
how="使用空间阻塞(Spatial Block)或缓冲区划分",
|
||||
connections=["空间自相关", "模型评估", "过拟合"]
|
||||
)
|
||||
|
||||
# 安排复习
|
||||
calendar.schedule_review("空间交叉验证", "new", 1)
|
||||
|
||||
print("知识已记录,复习计划已安排")
|
||||
|
||||
# 获取复习提示
|
||||
prompt = journal.get_review_prompt("空间交叉验证")
|
||||
print("\n--- 复习提示 ---")
|
||||
print(prompt)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 反思与延伸
|
||||
|
||||
### 思考问题
|
||||
|
||||
1. **知识审计**:你花时间学习的技能中,哪些已经过时?哪些仍然有价值?
|
||||
|
||||
2. **学习策略**:你目前的学习时间分配在哪个层次?是否需要调整?
|
||||
|
||||
3. **趋势判断**:你如何区分暂时热潮和真正重要的趋势?
|
||||
|
||||
4. **知识管理**:你如何追踪和管理自己的知识体系?
|
||||
|
||||
### 实践练习
|
||||
|
||||
1. **知识分层**:列出你最近学习的5项技术,分类到4个层次
|
||||
|
||||
2. **技术评估**:使用评估框架评估一个你正在考虑学习的技术
|
||||
|
||||
3. **回顾机制**:建立你自己的知识回顾系统
|
||||
|
||||
### 延伸阅读
|
||||
|
||||
- **"Make It Stick"** - 学习的科学
|
||||
- **"Ultralearning"** (Scott Young) - 高效自学方法
|
||||
- **"Range"** (David Epstein) - 广度vs深度的权衡
|
||||
|
||||
---
|
||||
|
||||
## 关键要点
|
||||
|
||||
1. **技术变化有层次**,原理层和思维层的变化远慢于应用层
|
||||
2. **学习投资应向上倾斜**,更多投入在持久知识上
|
||||
3. **建立技术评估框架**,系统化判断学习价值
|
||||
4. **设计持续学习机制**,包括回顾、整合和社区参与
|
||||
5. **理解什么不变比追逐什么在变更重要**
|
||||
Reference in New Issue
Block a user