ml4chem package
Subpackages
- ml4chem.atomistic package
- Subpackages
- ml4chem.atomistic.features package
- Submodules
- ml4chem.atomistic.features.aev module
- ml4chem.atomistic.features.autoencoders module
- ml4chem.atomistic.features.base module
- ml4chem.atomistic.features.cartesian module
- ml4chem.atomistic.features.coulombmatrix module
- ml4chem.atomistic.features.cutoff module
- ml4chem.atomistic.features.gaussian module
- Module contents
- ml4chem.atomistic.models package
- Submodules
- ml4chem.atomistic.models.autoencoders module
- ml4chem.atomistic.models.base module
- ml4chem.atomistic.models.gaussian_process module
- ml4chem.atomistic.models.kernelridge module
- ml4chem.atomistic.models.loss module
- ml4chem.atomistic.models.merger module
- ml4chem.atomistic.models.neuralnetwork module
- ml4chem.atomistic.models.se3net module
- Module contents
- ml4chem.atomistic.features package
- Submodules
- ml4chem.atomistic.potentials module
- Module contents
- Subpackages
- ml4chem.backends package
- ml4chem.data package
- ml4chem.optim package
Submodules
ml4chem.active module
ml4chem.metrics module
- ml4chem.metrics.compute_mae(outputs, targets, atoms_per_image=None)[source]
Compute MAE
Useful when using futures.
- Parameters:
outputs (list) – List of outputs.
targets (list) – List if targets.
atoms_per_image (list) – List of atoms per image.
- Returns:
mae – Mean absolute error.
- Return type:
float
- ml4chem.metrics.compute_mse(outputs, targets, atoms_per_image=None)[source]
Compute MSE
Useful when using futures.
- Parameters:
outputs (list) – List of outputs.
targets (list) – List if targets.
atoms_per_image (list) – List of atoms per image.
- Returns:
mse – Mean squared error.
- Return type:
float
- ml4chem.metrics.compute_rmse(outputs, targets, atoms_per_image=None)[source]
Compute RMSE
Useful when using futures.
- Parameters:
outputs (list) – List of outputs.
targets (list) – List if targets.
atoms_per_image (list) – List of atoms per image.
- Returns:
rmse – Root-mean squared error.
- Return type:
float
ml4chem.utils module
- ml4chem.utils.convert_elapsed_time(seconds)[source]
Convert elapsed time in seconds to HH:MM:SS format
- ml4chem.utils.dynamic_import(name, package, alt_name=None)[source]
A dynamic module importer
- Parameters:
name (str) – Name of the module to be imported.
package (str) – Path to package. Example: ml4chem.atomistic.features
alt_name (str) – Alternative module_name.
- Returns:
_class – An class object.
- Return type:
obj
- ml4chem.utils.get_chunks(sequence, chunk_size, svm=True)[source]
A function that yields a list in chunks
- Parameters:
sequence (list or dictionary) – A list or a dictionary to be split.
chunk_size (int) – Number of elements in each group.
svm (bool) – Whether or not these chunks are going to be used for kernel methods.
- ml4chem.utils.get_hash(image)[source]
Get the SHA1 hash of an image object
- Parameters:
image (object) – An image to be hashed.
- Returns:
_hash – Hash of image in string format
- Return type:
str
- ml4chem.utils.get_neighborlist(image, cutoff)[source]
Get the list of neighbors
- Parameters:
image (object) – ASE image.
- Return type:
A list of neighbors with offset distances.
- ml4chem.utils.get_number_of_parameters(model)[source]
Get the number of parameters
- Parameters:
model (obj) – Pytorch model to perform forward() and get gradients.
- Returns:
(total_params, train_params) tuple with total number of parameters and
number of trainable parameters.
- ml4chem.utils.lod_to_list(data, svm=False, requires_grad=False)[source]
List Of Dict (lod) to list
- Parameters:
data (list) – A list with ml4chem dictionaries. Those ones coming from get_chunks()
svm (bool, optional.) – Whether or not these chunks are going to be used for kernel methods, by default False.
requires_grad (bool, optional.) – Do we require gradients?, by default False.
- Returns:
A list of tensors or list of float.
- Return type:
_list
- ml4chem.utils.logger(filename=None, level=None, format=None, filemode='a')[source]
A wrapper to the logging python module
This module is useful for cases where we need to log in a for loop different files. It also will allow more flexibility later on how the logging format could evolve.
- Parameters:
filename (str, optional) – Name of logfile. If no filename is provided, we output to stdout.
level (str, optional) – Level of logging messages, by default ‘info’. Supported are: ‘info’ and ‘debug’.
format (str, optional) – Format of logging messages, by default ‘%(message)s’.
filemode (str, optional) – If filename is specified, open the file in this mode. Defaults to “a”. Supported modes are: “r” (read), “w” (write), “a” (append).
- Returns:
A logger object.
- Return type:
logger