DiscoveryResult Class
Description
TheDiscoveryResult dataclass contains all information about a completed discovery run, including the best solution found, its score, detailed metrics, and the location of output files.
Fields
Optional[Program]
The best
Program object found during discovery, or None if no valid programs were produced.Contains detailed information including solution code, metrics, lineage, and metadata.float
Score of the best program. Extracted from the
combined_score metric or aggregated from other metrics.Always a float value; 0.0 if no valid programs were found.str
Source code of the best solution as a string.Empty string if no valid programs were found.
Dict[str, Any]
Detailed metrics dictionary returned by the evaluator for the best program.Common keys:
combined_score: Overall score- Custom metrics defined by your evaluator
Optional[str]
Path to the directory containing results, logs, and checkpoints.
None if cleanup=True was used (temporary files removed).Optional[float]
Score of the initial program (if one was provided).
None if:- No initial program was provided
- Initial program evaluation failed
- Score could not be determined
Methods
repr
DiscoveryResult(best_score=0.8750, initial_score=0.4200)
Program Class
Program Fields
str
Unique identifier for the program (UUID).
str
Source code of the program.
str
Programming language (e.g., “python”, “cpp”, “javascript”).Default:
"python"Dict[str, Any]
Evaluation metrics returned by the evaluator.Typically includes:
combined_score: Overall score used for ranking- Custom metrics specific to your problem
int
Iteration number when this program was discovered.Default:
0 (initial program)Optional[str]
ID of the parent program this was mutated from.
None for initial programs or programs generated from scratch.Optional[List[str]]
List of IDs of other programs provided as context during generation.Used by search algorithms for crossover or learning from multiple examples.
Optional[Tuple[str, str]]
Additional information about the parent program as
(label, description).Optional[List[Tuple[str, str]]]
Additional information about context programs as list of
(label, description) tuples.float
Unix timestamp when the program was created.
Dict[str, Any]
Additional metadata about the program.Example keys:
image_path: For image generation tasks- Custom tracking information
Dict[str, Any]
Artifacts produced during evaluation (e.g., test outputs, visualizations).
Optional[Dict[str, Any]]
Prompts used to generate this program (if prompt logging is enabled).
int
Generation number in the evolutionary process.Default:
0Program Methods
to_dict
from_dict
data: Dictionary containing program fields
Program instance.
Examples
Basic Result Inspection
Accessing Detailed Metrics
Accessing the Program Object
Saving Results
Comparing Multiple Runs
Working with Program Lineage
Converting Program to Dictionary
Checking Result Status
Notes
DiscoveryResultis a dataclass, so all fields can be accessed as attributes- The
best_programfield contains the fullProgramobject with lineage information - Use
best_solutionfor quick access to just the source code metricscontains all evaluation metrics, not just the scoreoutput_dirisNonewhencleanup=True(temporary files removed)- The
initial_scorehelps measure improvement over the starting solution Programobjects can be serialized to/from dictionaries for storage
See Also
- run_discovery - Function that returns DiscoveryResult
- discover_solution - Alternative function returning DiscoveryResult
- Runner - Runner class that returns Program objects