中级
置换检验
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
import numpy as np
iris = load_iris()
setosa = iris.data[iris.target == ____, ____]
versicolor = iris.data[iris.target == ____, ____]
observed_diff = np.mean(____) - np.mean(____)
combined = np.concatenate(____)
n_setosa = len(____)
n_permutations = ____
perm_diffs = []
for _ in range(____):
np.random.shuffle(____)
perm_setosa = combined[:n_setosa]
perm_versicolor = combined[n_setosa:]
perm_diffs.append(np.mean(____) - np.mean(____))
perm_diffs = np.array(____)
p_value = np.sum(np.abs(____) >= np.abs(____)) / n_permutations
print(____)
print(____)
print(____)
plt.figure(figsize=(____, ____))
plt.hist(____)
plt.axvline(____)
plt.xlabel(____)
plt.ylabel(____)
plt.title(____)
plt.legend()
plt.grid(____)
plt.show()
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199