agentlab.experiments.args
Functions
|
Expand the given object into a list of objects with all combinations of CrossProd objects. |
|
Ablation study by modifying the start_point with only one change at a time, and restarting from the original start_point for each configuration. |
|
A kind of ablation study by changing the start_point with changes one by one. |
|
This will sample first and then expand the cross product. |
|
Sample the given object n_samples times. |
Classes
|
Use to specify that this will be sampled from a list of elements |
|
Use to specify that this will be part of a cross product |
Generic Class to identify that this is a distribution |
|
|
- class agentlab.experiments.args.Choice(elements, p=None)
Bases:
DistributionUse to specify that this will be sampled from a list of elements
- sample(rng=<module 'numpy.random' from '/home/docs/checkouts/readthedocs.org/user_builds/agentlab/envs/latest/lib/python3.12/site-packages/numpy/random/__init__.py'>)
- class agentlab.experiments.args.CrossProd(elements)
Bases:
objectUse to specify that this will be part of a cross product
- class agentlab.experiments.args.Distribution
Bases:
ABCGeneric Class to identify that this is a distribution
- sample()
- agentlab.experiments.args.expand_cross_product(obj: Any | list[Any])
Expand the given object into a list of objects with all combinations of CrossProd objects.
This function will recursively search for CrossProd objects in the given object and create a list of objects with all combinations of CrossProd. It searches through dataclasses and dictionaries.
- Parameters:
obj – Any | List[Any], The object to expand.
- Returns:
A list of objects with all combinations of CrossProd objects.
- Return type:
List[Any]
- agentlab.experiments.args.make_ablation_study(start_point, changes, return_cross_prod=True)
Ablation study by modifying the start_point with only one change at a time, and restarting from the original start_point for each configuration.
- Parameters:
start_point – the starting point of the ablation study
changes – a list of changes to make to the start_point. Each change is either a callable or tuple containing a string identifying the path in the object to change and the value to change to. ex: (“.obs.use_html”, True)
return_cross_prod – return a CrossProd object or just the list
- Returns:
A CrossProd object containing a list of objects with one change from start_point. If return_cross_prod is False, then it will return a list.
- agentlab.experiments.args.make_progression_study(start_point, changes, return_cross_prod=True)
A kind of ablation study by changing the start_point with changes one by one.
- Parameters:
start_point – the starting point of the study
changes – a list of changes to make to the start_point. Each change is either a callable or tuple containing a string identifying the path in the object to change and the value to change to. ex: (“.obs.use_html”, True)
return_cross_prod – return a CrossProd object or just the list
- Returns:
A CrossProd object containing a list of objects with progressive changes from start_point. If return_cross_prod is False, then it will return a list.
- agentlab.experiments.args.sample_and_expand_cross_product(obj: Any | list[Any], n_samples: int)
This will sample first and then expand the cross product.
- agentlab.experiments.args.sample_args(obj: Any | list[Any], n_samples: int)
Sample the given object n_samples times. Each sample is a deep copy of the original object with any object of type Distribution replaced by a sample from that distribution.
- Parameters:
obj – Any | List[Any], the object to sample
n_samples – int, the number of samples to generate
- Returns:
A list of n_samples objects with the given object.
- Return type:
List[Any]