ai4materials.models.cnn_polycrystals module¶
-
ai4materials.models.cnn_polycrystals.
predict
(x, y, configs, numerical_labels, text_labels, nb_classes=3, results_file=None, model=None, batch_size=32, conf_matrix_file=None, verbose=1, with_uncertainty=True, mc_samples=50, consider_memory=True, max_length=1000000.0)[source]¶
-
ai4materials.models.cnn_polycrystals.
predict_with_uncertainty
(data, model, model_type='classification', n_iter=1000)[source]¶ This function allows to calculate the uncertainty of a neural network model using dropout.
This follows Chap. 3 in Yarin Gal’s PhD thesis: http://mlg.eng.cam.ac.uk/yarin/thesis/thesis.pdf
- We calculate the uncertainty of the neural network predictions in the three ways proposed in Gal’s PhD thesis,
- as presented at pag. 51-54:
- variation_ratio: defined in Eq. 3.19
- predictive_entropy: defined in Eq. 3.20
- mutual_information: defined at pag. 53 (no Eq. number)
-
ai4materials.models.cnn_polycrystals.
reshape_images
(images, target_shape)[source]¶ Reshape images according to the target shape
-
ai4materials.models.cnn_polycrystals.
train_neural_network
(x_train, y_train, x_val, y_val, configs, partial_model_architecture, batch_size=32, nb_epoch=5, normalize=True, checkpoint_dir=None, neural_network_name='my_neural_network', training_log_file='training.log', early_stopping=False, data_augmentation=True)[source]¶ Train a neural network to classify crystal structures represented as two-dimensional diffraction fingerprints.
This model was introduced in [1].
x_train: np.array, [batch, width, height, channels]
[1] A. Ziletti, A. Leitherer, M. Scheffler, and L. M. Ghiringhelli, “Crystal-structure identification via Bayesian deep learning: towards superhuman performance”, in preparation (2018) Code author: Angelo Ziletti <angelo.ziletti@gmail.com>