ai2_kit.domain.selector module#
- class ai2_kit.domain.selector.CllModelDevSelectorContext(path_prefix: str, resource_manager: ai2_kit.core.resource_manager.ResourceManager)[source]#
Bases:
BaseCllContext
- class ai2_kit.domain.selector.CllModelDeviSelectorInput(config: ai2_kit.domain.selector.CllModelDeviSelectorInputConfig, model_devi_data: List[ai2_kit.core.artifact.Artifact], model_devi_file: str, type_map: List[str])[source]#
Bases:
object
- config: CllModelDeviSelectorInputConfig#
- model_devi_file: str#
- type_map: List[str]#
- pydantic model ai2_kit.domain.selector.CllModelDeviSelectorInputConfig[source]#
Bases:
BaseModel
Show JSON schema
{ "title": "CllModelDeviSelectorInputConfig", "type": "object", "properties": { "f_trust_lo": { "default": 0.0, "title": "F Trust Lo", "type": "number" }, "f_trust_hi": { "default": 65535.0, "title": "F Trust Hi", "type": "number" }, "new_explore_system_q": { "default": 0.25, "title": "New Explore System Q", "type": "number" }, "asap_options": { "anyOf": [ { "$ref": "#/$defs/AsapOptions" }, { "type": "null" } ], "default": null }, "screening_fn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Screening Fn" }, "max_decent_per_traj": { "default": -1, "title": "Max Decent Per Traj", "type": "integer" }, "workers": { "default": 4, "title": "Workers", "type": "integer" } }, "$defs": { "AsapOptions": { "additionalProperties": false, "properties": { "disable": { "default": false, "title": "Disable", "type": "boolean" }, "limit_per_cluster": { "default": 1, "title": "Limit Per Cluster", "type": "integer" }, "sort_by_ssw_energy": { "default": false, "title": "Sort By Ssw Energy", "type": "boolean" }, "descriptor": { "default": { "soap": { "crossover": false, "element_wise": false, "l_max": 6, "n_max": 6, "preset": "minimal", "r_cut": 3.5, "rbf": "gto", "reducer_type": "average", "sigma": 0.5, "zeta": 1 } }, "title": "Descriptor", "type": "object" }, "dim_reducer": { "default": { "pca": { "parameter": { "n_components": 3, "scalecenter": true }, "type": "PCA" } }, "title": "Dim Reducer", "type": "object" }, "cluster": { "default": { "dbscan": {} }, "title": "Cluster", "type": "object" } }, "title": "AsapOptions", "type": "object" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields:
- field asap_options: AsapOptions | None = None#
options for ASAP to further select candidates
- field f_trust_hi: float = 65535.0#
the upper bound of model_devi score to select the structure for labeling
- field f_trust_lo: float = 0.0#
the lower bound of model_devi score to select the structure for labeling
- field max_decent_per_traj: int = -1#
limit the max number of decent structures per trajectory, -1 means unlimited
- field new_explore_system_q: float = 0.25#
the quantile of model_devi score to select the structure for next round of exploration
- field screening_fn: str | None = None#
the function to screen the candidates, e.g “lambda x: x[‘ssw_energy’] < -1000”
- field workers: int = 4#
number of workers to run the analysis
- pydantic model AsapOptions[source]#
Bases:
BaseModel
Show JSON schema
{ "title": "AsapOptions", "type": "object", "properties": { "disable": { "default": false, "title": "Disable", "type": "boolean" }, "limit_per_cluster": { "default": 1, "title": "Limit Per Cluster", "type": "integer" }, "sort_by_ssw_energy": { "default": false, "title": "Sort By Ssw Energy", "type": "boolean" }, "descriptor": { "default": { "soap": { "crossover": false, "element_wise": false, "l_max": 6, "n_max": 6, "preset": "minimal", "r_cut": 3.5, "rbf": "gto", "reducer_type": "average", "sigma": 0.5, "zeta": 1 } }, "title": "Descriptor", "type": "object" }, "dim_reducer": { "default": { "pca": { "parameter": { "n_components": 3, "scalecenter": true }, "type": "PCA" } }, "title": "Dim Reducer", "type": "object" }, "cluster": { "default": { "dbscan": {} }, "title": "Cluster", "type": "object" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields:
cluster (dict)
descriptor (dict)
dim_reducer (dict)
disable (bool)
limit_per_cluster (int)
sort_by_ssw_energy (bool)
- field cluster: dict = {'dbscan': {}}#
- field descriptor: dict = {'soap': {'crossover': False, 'element_wise': False, 'l_max': 6, 'n_max': 6, 'preset': 'minimal', 'r_cut': 3.5, 'rbf': 'gto', 'reducer_type': 'average', 'sigma': 0.5, 'zeta': 1}}#
- field dim_reducer: dict = {'pca': {'parameter': {'n_components': 3, 'scalecenter': True}, 'type': 'PCA'}}#
- field disable: bool = False#
- field limit_per_cluster: int = 1#
limit the number of structures to be selected from the same cluster
- field sort_by_ssw_energy: bool = False#
sorted the structures by ssw_energy in each cluster
- class ai2_kit.domain.selector.CllModelDeviSelectorOutput(candidates: List[ai2_kit.core.artifact.Artifact], passing_rate: float, new_explore_systems: List[ai2_kit.core.artifact.Artifact])[source]#
Bases:
ICllSelectorOutput
- passing_rate: float#
- ai2_kit.domain.selector.bulk_select_distinct_structures(candidates: List[ArtifactDict], descriptor_opt: dict, dim_reducer_opt: dict, cluster_opt: dict, type_map: List[str], work_dir: str, limit_per_cluster: int = -1, sort_by_energy: bool = False, workers: int = 4) List[ArtifactDict] [source]#
- ai2_kit.domain.selector.bulk_select_structures_by_model_devi(model_devi_outputs: List[ArtifactDict], model_devi_file: str, f_trust_lo: float, f_trust_hi: float, new_explore_system_q: float, type_map: List[str], work_dir: str, max_decent_per_traj: int, screening_fn: str | None, workers: int = 4) List[Tuple[Dict[str, ArtifactDict], dict]] [source]#
- async ai2_kit.domain.selector.cll_model_devi_selector(input: CllModelDeviSelectorInput, ctx: CllModelDevSelectorContext)[source]#
- ai2_kit.domain.selector.select_distinct_structures(candidates: List[ArtifactDict], attrs: dict, descriptor_opt: dict, dim_reducer_opt: dict, cluster_opt: dict, type_map: List[str], work_dir: str, limit_per_cluster: int = -1, sort_by_energy: bool = False)[source]#
- ai2_kit.domain.selector.select_structures_by_model_devi(model_devi_output: ArtifactDict, model_devi_file: str, f_trust_lo: float, f_trust_hi: float, type_map: List[str], work_dir: str, new_explore_system_q: float, max_decent_per_traj: int, screening_fn: str | None) Tuple[Dict[str, ArtifactDict], dict] [source]#
analysis the model_devi output of explore stage and select candidates
- Parameters:
next_explore_system_q – the quantile of model_devi score to select the structure for next round of exploration