MCPcopy Create free account
hub / github.com/LeMo-CtRes/CtRes / plot_complete_overview

Function plot_complete_overview

utils/utils_data.py:577–613  ·  view source on GitHub ↗

创建完整的总览图

(all_results, rpm_names, retain_rates, output_dir, logger)

Source from the content-addressed store, hash-verified

575
576
577def plot_complete_overview(all_results, rpm_names, retain_rates, output_dir, logger):
578 """
579 创建完整的总览图
580 """
581 fig, axes = plt.subplots(2, 3, figsize=(18, 12))
582 axes = axes.flatten()
583
584 for rpm_idx, rpm_name in enumerate(rpm_names):
585 if rpm_idx >= len(axes):
586 break
587
588 ax = axes[rpm_idx]
589
590 if rpm_name in all_results:
591 for retain_rate in retain_rates:
592 if retain_rate in all_results[rpm_name]:
593 results = all_results[rpm_name][retain_rate]
594 if results:
595 srs = [r[0] for r in results]
596 test_accs = [r[2] for r in results]
597 ax.plot(srs, test_accs, marker='o', label=f'{retain_rate:.1f}', linewidth=1.5)
598
599 ax.set_title(f'RPM {rpm_name}')
600 ax.set_xlabel('Spectral Radius')
601 ax.set_ylabel('Test Accuracy')
602 ax.grid(True, alpha=0.3)
603 ax.legend(title='Retain Rate', fontsize=8)
604
605 # 隐藏多余的子图
606 for i in range(len(rpm_names), len(axes)):
607 axes[i].set_visible(False)
608
609 plt.tight_layout()
610 overview_path = output_dir / "complete_overview.png"
611 plt.savefig(overview_path, dpi=300, bbox_inches='tight')
612 plt.close()
613 logger.info(f"Complete overview plot saved: {overview_path}")
614
615
616def plot_loss_accuracy(file_path='loss.txt'):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected