kliff.models.model_torch¶
- class kliff.models.model_torch.ModelTorch(descriptor, seed=35)[source]¶
Base class for machine learning models.
Typically, a user will not directly use this.
- Parameters:
descriptor (
Descriptor) – atomic environment descriptor for computing configuration fingerprints. SeeSymmetryFunction()andBispectrum().seed (
int) – random seed.
- write_kim_model(path=None)[source]¶
Write the model out as a KIM-API compatible one.
- Parameters:
path (
Optional[Path]) – path to write the model
- fit(path)[source]¶
Fit the model using analytic solution.
- Parameters:
path (
Path) – path to the fingerprints generated by the descriptor.
- save(filename)[source]¶
Save a model to disk.
- Parameters:
filename (
Path) – Path to store the model.
- load(filename, mode='train')[source]¶
Load a save model.
- Parameters:
filename (
Path) – Path where the model is stored, e.g. kliff_model.pklmode (
str) – Purpose of the loaded model. Should be either train or eval.
- set_save_metadata(prefix, start, frequency=1)[source]¶
Set metadata that controls how the model are saved during training.
If this function is called before minimization starts, the model will be saved to the directory specified by prefix every frequency epochs, beginning at the start epoch.
- Parameters:
prefix (
Path) – Path to the directory where the models are saved. Model will be named as {prefix}/model_epoch{ep}.pt, where ep is the epoch number.start (
int) – Epoch number at which begins to save the model.frequency (
int) – Save the model every frequency epochs.
- property descriptor¶
- property device¶
- property dtype¶
- property save_prefix¶
- property save_start¶
- property save_frequency¶