Configuration¶
schema ¶
Configuration schema and validation for AdaptivePy runs.
RunConfig
dataclass
¶
RunConfig(features_dir: Path, output_dir: Path, trajectories_dir: Optional[Path] = None, topology: Optional[Path] = None, clustering: ClusteringConfig = ClusteringConfig(), policies: List[str] = (lambda: ['least_counts'])(), n_seeds: int = DEFAULT_N_SEEDS, seed_selection: SeedSelectionConfig = SeedSelectionConfig(), random_seed: int = DEFAULT_RANDOM_SEED, write_pdbs: bool = True, policy_params: Dict[str, Dict[str, Any]] = dict(), metapolicy: MetapolicyConfig = MetapolicyConfig())
Full configuration for an adaptive sampling run.
Attributes:
| Name | Type | Description |
|---|---|---|
features_dir |
Path
|
Directory containing |
output_dir |
Path
|
Directory where results are written. |
trajectories_dir |
Path or None
|
Optional directory containing coordinate trajectories. |
topology |
Path or None
|
Topology file required when trajectories are provided. |
clustering |
ClusteringConfig
|
Clustering settings. |
policies |
list of str
|
Policy names to evaluate in parallel. |
n_seeds |
int
|
Number of seed frames to select per policy. |
seed_selection |
SeedSelectionConfig
|
Frame selection method within chosen clusters. |
random_seed |
int
|
Global random seed for reproducibility. |
write_pdbs |
bool
|
Whether to write PDB files when trajectories are available. |
ClusteringConfig
dataclass
¶
ClusteringConfig(method: str = DEFAULT_CLUSTERING_METHOD, n_clusters: int = 10, params: Dict[str, Any] = dict())
Clustering backend configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
method |
str
|
Clustering method name: |
n_clusters |
int
|
Number of clusters to fit. |
params |
dict
|
Additional keyword arguments passed to the clusterer. |
SeedSelectionConfig
dataclass
¶
Frame-level seed selection configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
method |
str
|
Selection method: |
load_config ¶
Load and parse a YAML run configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the YAML configuration file. |
required |
Returns:
| Type | Description |
|---|---|
RunConfig
|
Parsed and validated configuration object. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the configuration file does not exist. |
ValueError
|
If required fields are missing or invalid. |
config_to_dict ¶
Convert a :class:RunConfig to a plain dictionary for serialization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
RunConfig
|
Configuration object to serialize. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
YAML-serializable configuration dictionary. |
build_policy_kwargs ¶
build_policy_kwargs(policy_name: str, config: RunConfig, n_features: Optional[int] = None, traj_names: Optional[Sequence[str]] = None, n_clusters: Optional[int] = None, n_seeds: Optional[int] = None, traj_index_map: Optional[Dict[int, tuple[int, int]]] = None) -> Dict[str, Any]
Build constructor keyword arguments for a configured policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy_name
|
str
|
Registered policy name. |
required |
config
|
RunConfig
|
Parsed run configuration. |
required |
n_features
|
int or None
|
Feature dimensionality for policies that require it. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Keyword arguments forwarded to :func: |
validate_fast_policy_params ¶
Validate and normalize FAST policy parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict
|
Raw FAST policy settings from configuration. |
required |
n_features
|
int
|
Number of feature dimensions in the loaded dataset. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Normalized keyword arguments for :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If required FAST settings are missing or invalid. |
validate_ma_reap_policy_params ¶
validate_ma_reap_policy_params(params: Dict[str, Any], traj_names: Sequence[str], n_features: int, n_seeds: int = DEFAULT_N_SEEDS, n_clusters: Optional[int] = None) -> Dict[str, Any]
Validate and normalize MA-REAP policy parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict
|
Raw MA-REAP settings from configuration. |
required |
traj_names
|
sequence of str
|
Feature file stems in the loaded dataset. |
required |
n_features
|
int
|
Number of feature dimensions. |
required |
n_seeds
|
int
|
Seeds to select per policy run. |
DEFAULT_N_SEEDS
|
n_clusters
|
int or None
|
Number of populated clusters after clustering. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Normalized keyword arguments for :class: |
validate_knn_as_policy_params ¶
Validate and normalize kNN-AS policy parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict
|
Raw kNN-AS policy settings from configuration. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Normalized keyword arguments for :class: |
validate_maxent_vampnet_policy_params ¶
validate_maxent_vampnet_policy_params(params: Dict[str, Any], n_features: int, traj_index_map: Optional[Dict[int, tuple[int, int]]] = None) -> Dict[str, Any]
Validate and normalize MaxEnt VAMPNet policy parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict
|
Raw MaxEnt VAMPNet settings from configuration. |
required |
n_features
|
int
|
Number of feature dimensions in the loaded dataset. |
required |
traj_index_map
|
dict or None
|
Mapping from trajectory ID to |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Normalized keyword arguments for :class: |
validate_ts_dar_policy_params ¶
validate_ts_dar_policy_params(params: Dict[str, Any], n_features: int, traj_index_map: Optional[Dict[int, tuple[int, int]]] = None) -> Dict[str, Any]
Validate and normalize TS-DAR policy parameters.