界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
文档与办公 · SKILL.md

results-and-visuals

results-and-visuals

【文档与办公】Summarize, plot, export, and debug completed PyGAD runs using summary, logger, plot_* methods, and PDF reports.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: results-and-visuals description: "Summarize, plot, export, and debug completed PyGAD runs using summary, logger, plot_* methods, and PDF reports." metadata: disco-role: operating disable-model-invocation: true license: BSD 3-Clause

results-and-visuals

Use this sub-skill when the task is to inspect, visualize, or export a completed pygad.GA run.

Route elsewhere

  • Tuning the optimizer, fitness, selection, crossover, mutation, callbacks, or save/load state: use genetic-algorithm.
  • Built-in benchmarks and quality indicators: use benchmarks.
  • GA-based neural-network adapters: use neural-networks.

Operating flow

  1. Confirm the run completed and that the data you need was saved:
    • ga.generations_completed >= 1
    • save_solutions=True for history-based plots
    • save_best_solutions=True for plot_genes(solutions="best")
  2. Switch plotting to a headless backend before creating figures in scripts or CI.
  3. Use ga.summary() to inspect the lifecycle table and the configured logger. Pass a custom logging.Logger through pygad.GA(..., logger=...) when you want file output or structured logs.
  4. Call the needed plot_*() method and save it via save_dir when you want a file artifact.
  5. Call ga.generate_report() when you want one PDF that bundles the run summary and applicable plots.

Reference map

Bundled safe scripts

  • scripts/plot_report_smoke.py: deterministic headless smoke that runs a small single-objective and multi-objective GA, prints a summary through a custom logger, writes temporary PNGs, and exports a temporary PDF report.

Safety notes

  • Plot methods need matplotlib; generate_report() needs both matplotlib and reportlab.
  • plot_new_solution_rate(), plot_fitness_band(), plot_population_diversity(), plot_non_dominated_hypervolume(), and plot_pareto_front_evolution() require save_solutions=True.
  • plot_genes(solutions="best") requires save_best_solutions=True; plot_genes(solutions="all") requires save_solutions=True.
  • Pareto-front curve/evolution plots require a completed multi-objective run; the 2D/3D curve only supports 2 or 3 objectives.
我的收藏