Analysis
abses.utils.analysis.ResultAnalyzer ¶
Bases: _BaseAnalyzer
Analyzer for a single Hydra run result.
This class analyzes the output of a single Hydra experiment run, including reading configuration, loading data files, and extracting reporter information.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
DataFrame
|
Raw data loaded from CSV or datacollector output. |
configs |
Dict[str, Any]
|
Full configuration dictionary. |
model_reporter |
Dict[str, Any]
|
Model-level reporter configuration. |
agent_reporter |
Dict[str, Dict[str, Any]]
|
Agent-level reporter configuration. |
final_reporter |
Dict[str, Any]
|
Final reporter configuration. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathLike
|
Path to the single run output directory. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the path is not a valid directory. |
Source code in abses/utils/analysis.py
data
property
writable
¶
Raw data loaded from CSV or datacollector output.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame containing the raw data. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If data has not been loaded yet. |
read_data ¶
Read and merge result csv files under the experiment folder.
This method will:
- First, look for all files matching *_cities.csv (e.g. 1_cities.csv,
2_cities.csv ...) under self.path.
- If found, read them all and vertically concatenate them into a single
dataframe.
- If none are found, fall back to reading a single cities.csv file.
Source code in abses/utils/analysis.py
read_csv ¶
Read a CSV file into a DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathLike
|
Path to the CSV file. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame containing the CSV data. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist or is invalid. |
Source code in abses/utils/analysis.py
get_data
cached
¶
Get processed data with optional transformations.
This method can be overridden or extended to support different aggregation levels or data transformations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Additional arguments for data processing. |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Processed DataFrame. |
Source code in abses/utils/analysis.py
abses.utils.analysis.ExpAnalyzer ¶
Bases: _BaseAnalyzer
Analyzer for a group of Hydra multirun experiment results.
This class analyzes multiple experiment runs from a Hydra multirun, including parsing configuration overrides, aggregating data, and comparing differences between runs.
Attributes:
| Name | Type | Description |
|---|---|---|
overrides |
Dict[str, List[str]]
|
Dictionary of configuration overrides from multirun.yaml. |
results |
Generator[ResultAnalyzer, None, None]
|
Generator yielding ResultAnalyzer for each run. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathLike
|
Path to the multirun output directory. |
required |
enable_logger
|
bool
|
Whether to enable logging (default: True). |
True
|
Source code in abses/utils/analysis.py
overrides
property
¶
results
property
¶
Generator yielding ResultAnalyzer for each run.
Yields:
| Type | Description |
|---|---|
ResultAnalyzer
|
ResultAnalyzer instance for each subdirectory in the multirun output. |
diff_runs
cached
property
¶
DataFrame showing configuration differences between runs.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns for each override parameter and rows |
DataFrame
|
for each run, showing the actual values used. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If unexpected configuration values are found. |
agg_data
cached
property
¶
Aggregated data from all runs.
This property aggregates data from all runs and adds configuration override columns to identify each run.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame containing aggregated data from all runs. |
Note
This is a cached property. To refresh, delete the attribute or use a new instance.
apply ¶
Apply a function to each run's ResultAnalyzer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Any]
|
Function to apply. Should accept ResultAnalyzer as first argument. |
required |
*args
|
Any
|
Additional positional arguments for the function. |
()
|
**kwargs
|
Any
|
Additional keyword arguments for the function. |
{}
|
Returns:
| Type | Description |
|---|---|
Series
|
Series with results from applying the function to each run. |