diff --git a/docs/RL.md b/docs/RL.md index 2b7b80a739..c66d7a21f8 100644 --- a/docs/RL.md +++ b/docs/RL.md @@ -58,3 +58,38 @@ - 自动驾驶 - 推荐系统 - 资源调度 + +## 代码示例 + +使用 PyTorch 实现 DQN 网络: + +```python +import torch +import torch.nn as nn + +class DQN(nn.Module): + """深度Q网络""" + def __init__(self, state_dim, action_dim): + super(DQN, self).__init__() + self.net = nn.Sequential( + nn.Linear(state_dim, 128), + nn.ReLU(), + nn.Linear(128, 128), + nn.ReLU(), + nn.Linear(128, action_dim) + ) + + def forward(self, x): + return self.net(x) +``` + +## 在 Carla 中的应用 + +- **车道保持**:以偏离车道线距离作为负奖励 +- **避障**:碰撞时给予大额负奖励,安全行驶给予正奖励 +- **速度控制**:以实际速度与目标速度差值作为奖励信号 + +## 参考资料 + +- [PyTorch 强化学习教程](https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html) +- [OpenAI Gym 文档](https://gymnasium.farama.org/) diff --git a/docs/gaussian_mixture.md b/docs/gaussian_mixture.md index 4f2ea7cbce..5bc0e45fb0 100644 --- a/docs/gaussian_mixture.md +++ b/docs/gaussian_mixture.md @@ -44,3 +44,34 @@ - 异常检测 - 图像分割 - 语音识别 +- +## 数学公式 + +GMM 的概率密度函数为: + +`p(x) = Σ π_k * N(x | μ_k, Σ_k)` + +其中: +- K 为高斯成分数量 +- π_k 为第 k 个成分的混合权重,满足 Σπ_k = 1 +- N(x | μ_k, Σ_k) 为第 k 个高斯分布 + +## 代码示例 + +使用 scikit-learn 拟合高斯混合模型: + +```python +from sklearn.mixture import GaussianMixture +import numpy as np + +# 生成示例数据 +X = np.random.randn(300, 2) + +# 创建并训练模型 +gmm = GaussianMixture(n_components=3, random_state=0) +gmm.fit(X) + +# 预测类别 +labels = gmm.predict(X) +print("各成分权重:", gmm.weights_) +``` diff --git a/ignore_users.json b/ignore_users.json index ed695fe839..584595373e 100644 --- a/ignore_users.json +++ b/ignore_users.json @@ -1,5 +1,8 @@ [ - "Haidong Wang", - "donghaiwang", - "whd@hutb.edu.cn" -] \ No newline at end of file + { + "name": "Haidong Wang", + "github": "donghaiwang", + "email": "whd@hutb.edu.cn", + "role": "author" + } +]