smact.property_prediction.roost module#
ROOST (Representation Learning from Stoichiometry) predictor implementation for composition-only property prediction.
ROOST-based property predictor implementation.
This module provides the RoostPropertyPredictor class for predicting material properties from chemical composition using pre-trained ROOST (Representation Learning from Stoichiometry) models.
- class smact.property_prediction.roost.predictor.RoostPropertyPredictor(property_name: str, fidelity: str | None = None, model_name: str | None = None, model_path: str | Path | None = None, device: str = 'cpu', elem_embedding: str = 'matscholar200', batch_size: int = 128, **kwargs: Any)[source]#
Bases:
BasePropertyPredictorProperty predictor using pre-trained ROOST models.
ROOST (Representation Learning from Stoichiometry) predicts material properties from composition alone using message passing on stoichiometric graphs. This class loads pre-trained checkpoints and performs inference.
Example
>>> predictor = RoostPropertyPredictor(property_name="band_gap") >>> predictions = predictor.predict(["NaCl", "TiO2"])
>>> # With fidelity selection >>> predictor = RoostPropertyPredictor(property_name="band_gap", fidelity="hse06")
>>> # With uncertainty quantification >>> result = predictor.predict(["NaCl"], return_uncertainty=True) >>> print(result.uncertainties)
- available_properties#
Class attribute listing all supported properties.
- Type:
ClassVar[list[str]]
- elem_embedding#
Element embedding type used by the model.
- batch_size#
Batch size for inference.
- available_properties: ClassVar[list[str]] = ['band_gap']#
- classmethod from_checkpoint(checkpoint_path: str | Path, property_name: str, device: str = 'cpu', **kwargs: Any) RoostPropertyPredictor[source]#
Create predictor from a local checkpoint directory.
- Parameters:
checkpoint_path – Path to checkpoint directory containing model.json, model.pt, and state.pt files.
property_name – Name of the property.
device – Device to run on (“cpu” or “cuda”).
**kwargs – Additional arguments passed to constructor.
- Returns:
Initialised RoostPropertyPredictor.
- predict(compositions: str | list[str], return_uncertainty: bool = False, validate_smact: bool = True) ndarray | PredictionResult[source]#
Predict property values for given compositions.
- Parameters:
compositions – Single composition string or list of composition strings (e.g., “NaCl”, [“TiO2”, “GaN”]).
return_uncertainty – If True, return PredictionResult with uncertainty estimates (requires robust model).
validate_smact – Whether to validate compositions using SMACT. Set to False to skip validation.
- Returns:
Property predictions as numpy array, or PredictionResult object if return_uncertainty is True.
- property supported_properties: list[str]#
List of properties supported by ROOST predictor.