kliff.models.neural_network

class kliff.models.neural_network.NeuralNetwork(descriptor, seed=35)[source]

Neural Network model.

A feed-forward neural network model.

Parameters:
  • descriptor (Descriptor) – A descriptor that transforms atomic environment information to the fingerprints, which are used as the input for the neural network.

  • seed – Global seed for random numbers.

add_layers(*layers)[source]

Add layers to the sequential model.

Parameters:

layers – torch.nn layers torch.nn layers that are used to build a sequential model. Available ones including: torch.nn.Linear, torch.nn.Dropout, and torch.nn.Sigmoid among others. See https://pytorch.org/docs/stable/nn.html for a full list.

forward(x)[source]

Forward pass through the neural network.

Parameters:

x – input descriptor to the neural network.

Returns:

The output of the neural network.

write_kim_model(path=None, driver_name='DUNN__MD_292677547454_000', dropout_ensemble_size=None)[source]

Write out a model that is compatible with the KIM API.

Parameters:
  • path (Optional[Path]) – Path to write the model. If None, defaults to ./NeuralNetwork_KLIFF__MO_000000111111_000.

  • driver_name (str) – Name of the model driver.

  • dropout_ensemble_size (Optional[int]) – Size of the dropout ensemble. Ignored if not fitting a dropout NN. Otherwise, defaults to 100 if None.

exception kliff.models.neural_network.NeuralNetworkError(msg)[source]