Skip to content

Releases: pycroscopy/atomai

v0.7.8

30 Sep 20:46
657ee4f
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.7.4...v0.7.8

v0.7.4

01 Apr 13:34
1671716
Compare
Choose a tag to compare

Minor fixes and improvements

  • Extend Thompson sampler to 'multi-task' DKL-GP models
  • Fix bugs in stat.multivar.update_classes() that didn't allow specifying custom window size

v0.7.3

06 Sep 03:13
f20ac7b
Compare
Choose a tag to compare
  • Ensemble deep kernel learning (DKL) as an 'approximation' to the fully Bayesian DKL
  • Thompson sampler for active learning now comes as a built-in method in the DKL class
  • Option to select between correlated and independent outputs for vector-valued function in DKL

Example of using an ensemble of DKL models:

# Initialize and train ensemble of models
dklgp = aoi.models.dklGPR(indim=X_train.shape[-1], embedim=2)
dklgp.fit_ensemble(X_train, y_train, n_models=5, training_cycles=1500, lr=0.01)
# Make a prediction
y_samples = dklgp.sample_from_posterior(X_test, num_samples=1000) # n_models x n_samples x n_data
y_pred = y_samples.mean(axis=(0,1)) # average over model and sample dimensions
y_var = y_samples.var(axis=(0,1))

Example of using a built-in Thompson sampler for active learning:

for e in range(exploration_steps):
    # obtain/update DKL-GP posterior
    dklgp = aoi.models.dklGPR(data_dim, embedim=2, precision="single")
    dklgp.fit(X_train, y_train, training_cycles=50)
    # Thompson sampling for selecting the next measurement/evaluation point
    obj, next_point = dklgp.thompson(X_cand)
    # Perform a 'measurement'
    y_measured = measure(next_point)
    # Update measured and candidate points, etc...

v0.7.2

02 Jul 00:33
e2bce6a
Compare
Choose a tag to compare

Bug fixes and additional utility functions for image and spectral data processing

v0.7.1

18 Jun 09:15
379f746
Compare
Choose a tag to compare

Minor release to patch some numerical stability issues with DKL-GP

v0.7.0

17 Jun 23:06
eb09453
Compare
Choose a tag to compare

New functionalities

1) Deep kernel learning (DKL)-based Gaussian process (GP) regression.

The DKL-GP is based on this paper and can be used for predicting a functional property (or properties) from structural data such as images. Example of usage:

# Structural image data
n, d1, d2 = imgstack.shape
x_train = imgstack.reshape(n, d1*d2)
# Property
y_train = P[:, 0] # can be a scalar or vector variable

# Input data dims
data_dim = x_train.shape[-1]
# Initialize model
dklgp = aoi.models.dklGPR(data_dim)
# Train
dklgp.fit(
    x_train y_train, # inputs and outputs
    training_cycles=100, precision="single", lr=1e-2  # training parameters
)

# Make a prediction (with quantified uncertainty) with the trained model
mean, var = dklgp.predict(x_new)

For more details, see the example notebook

2) Pre-trained models

One can now load pre-trained models for atomic feature finding in graphene and BFO-like systems. Currently limited to STEM data. Example of usage:

# Load model for atom finding in graphene, which was trained on simulated data
model = aoi.models.load_pretrained_model("G_MD")
# Apply to your data
nn_out, coords = model.predict(new_data)

As with any machine learning model, there is a caveat that the performance of pre-trained models will likely degrade significantly on the out-of-distribution data (different feature size, presence of objects on the surface not accounted for in the simulations, etc.)

Bug fixes

  • The extractor of image patches now checks for NaNs in the cropped data.

v0.6.8

01 Jun 01:40
4a8a599
Compare
Choose a tag to compare
  • Add atomai.utils.dataset module with experimental datasets for scientific machine learning
  • Minor bug fixes and documentation improvement

v0.6.7

14 May 01:27
193096f
Compare
Choose a tag to compare

New functionalities

  • Utility functions for converting Segmentor output (coordinates and classes) to files readable by packages such as Atomic Simulation Environment, VESTA, etc.
  • Optional time-dependent learning rate. For example,
# We are going to start with a constant learning rate, then after 600 iterations we begin
# linearly decreasing it over the next 200 iterations, and keep constant afterwards
lr_t = np.ones(800) * 1e-3
lr_t[600:800] = np.linspace(1e-3, 1e-4, 200)

model.fit(images, labels, images_test, labels_test,  # training data
          training_cycles=1000, compute_accuracy=True,  # basic training parameters
          swa=True, lr_scheduler=lr_t  # advanced training parameters
)

Other changes

  • Added new examples (Graph analysis and Im2Spec) and expanded explanations in the markdown parts for the old ones
  • Improved (slightly) documentation

v0.6.6

11 Mar 02:14
9a9fd7a
Compare
Choose a tag to compare

New functionality

Bug fixes

  • Fixed bug that was preventing from loading (older) AtomAI models without saved optimizer in their meta-dictionary

Other

  • Fixed some inconsistencies in classes/methods documentation
  • Tested against the newest PyTorch release (1.8.0)

v0.6.5

26 Feb 20:01
7fb6dcd
Compare
Choose a tag to compare

New functionalities:

  • Add VAE that can learn (simultaneously) both discrete and continuous latent representations
    image
  • Add option for annealing of the KL terms associated with rotation and image content to rVAE

Bug fixes

  • Fix bug that prevented rVAE from working in non-square images
  • Fix bug that was causing VAE decoders to "forget" apply sigmoid in evaluation regime after training with BCE with logits

Other improvements

  • Add option to set custom encoder and decoder modules in all VAEs
  • Add a substantial amount of tests for VI trainer and VAE modules
  • Update docs