Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- bayesian_core.py +2 -1
- bayesian_utils.py +15 -2
bayesian_core.py
CHANGED
|
@@ -128,7 +128,8 @@ class BayesianHierarchicalAnalyzer:
|
|
| 128 |
chains=n_chains,
|
| 129 |
target_accept=target_accept,
|
| 130 |
return_inferencedata=True,
|
| 131 |
-
progressbar=False
|
|
|
|
| 132 |
)
|
| 133 |
|
| 134 |
# 生成摘要統計
|
|
|
|
| 128 |
chains=n_chains,
|
| 129 |
target_accept=target_accept,
|
| 130 |
return_inferencedata=True,
|
| 131 |
+
progressbar=False, # 在 Streamlit 中關閉進度條
|
| 132 |
+
discard_tuned_samples=False # 👈 加這行!保留 tune 樣本
|
| 133 |
)
|
| 134 |
|
| 135 |
# 生成摘要統計
|
bayesian_utils.py
CHANGED
|
@@ -24,8 +24,21 @@ def plot_trace(trace, var_names=['d', 'sigma']):
|
|
| 24 |
fig, axes = plt.subplots(len(var_names), 2, figsize=(14, 4 * len(var_names)))
|
| 25 |
if len(var_names) == 1:
|
| 26 |
axes = axes.reshape(1, -1)
|
| 27 |
-
|
| 28 |
-
az.plot_trace(trace, var_names=var_names, axes=axes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
plt.tight_layout()
|
| 30 |
|
| 31 |
# 轉換為圖片
|
|
|
|
| 24 |
fig, axes = plt.subplots(len(var_names), 2, figsize=(14, 4 * len(var_names)))
|
| 25 |
if len(var_names) == 1:
|
| 26 |
axes = axes.reshape(1, -1)
|
| 27 |
+
|
| 28 |
+
az.plot_trace(trace, var_names=var_names, axes=axes,
|
| 29 |
+
combined=False,
|
| 30 |
+
compact=False)
|
| 31 |
+
|
| 32 |
+
# 加上 Tune 結束的垂直線
|
| 33 |
+
for i in range(len(var_names)):
|
| 34 |
+
if i == 0:
|
| 35 |
+
axes[i, 1].axvline(x=1000, color='red', linestyle='--',
|
| 36 |
+
linewidth=2, alpha=0.7, label='Tune結束')
|
| 37 |
+
axes[i, 1].legend(loc='upper right', fontsize=9)
|
| 38 |
+
else:
|
| 39 |
+
axes[i, 1].axvline(x=1000, color='red', linestyle='--',
|
| 40 |
+
linewidth=2, alpha=0.7)
|
| 41 |
+
|
| 42 |
plt.tight_layout()
|
| 43 |
|
| 44 |
# 轉換為圖片
|