OSCR

Uncertainty aware machine learning for bridging simulation and experiment in high throughput materials characterization.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Proposed method › Machine learning model architecture ↔ USEM.py, lines 93–135 · score 0.76 · hidden layers, Spectral normalization, Strides, padding, filters, ReLU
  2. [2] § Technological background › Spectral-normalized Neural Gaussian Process (SNGP) ↔ USEM.py, lines 93–135 · score 0.62 · hidden representation, hidden layer, spectral, bounding, residual, dimensionality

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 248 lines · 8.4 KB · no license · 2 matches

  1. import os
  2. import adapt
  3. import numpy as np
  4. import pandas as pd
  5. import tensorflow as tf
  6. import matplotlib.pyplot as plt
  7. import numpy as np
  8. from sklearn.preprocessing import OneHotEncoder
  9. from sklearn.decomposition import PCA
  10. from sklearn.manifold import TSNE
  11. from sklearn.metrics import accuracy_score, top_k_accuracy_score
  12. from sklearn.datasets import make_moons
  13. from tensorflow.keras import Model, Sequential
  14. from tensorflow.keras.optimizers.legacy import Adam, SGD, RMSprop, Adagrad
  15. from tensorflow.keras.layers import Dense, Input, Dropout, Conv2D, MaxPooling2D, GlobalMaxPooling2D, Flatten, Reshape, GaussianNoise, BatchNormalization
  16. from tensorflow.keras.constraints import MinMaxNorm
  17. from tensorflow.keras.regularizers import l2
  18. from adapt.feature_based import DANN, ADDA, DeepCORAL, CORAL, MCD, MDD, WDGRL, CDAN
  19. import glob
  20. #%% data
  21. # simulation data
  22. data = []
  23. filename = []
  24. path = '.../Metals 03182024/'
  25. for file_name in glob.glob(path+'*.csv'):
  26. x = pd.read_csv(file_name)
  27. data.append(x.values.tolist())
  28. filename.append(file_name[44:-4])
  29. loaded_images = np.array(data)
  30. crystal_system = [x[:3] for x in filename]
  31. crystal_system_label = (np.array(crystal_system)=='BCC')*0 + (np.array(crystal_system)=='FCC')*1 + (np.array(crystal_system)=='HCP')*2
  32. for i in range(1):
  33. plt.imshow(loaded_images_resized[i], cmap=plt.cm.jet)
  34. plt.colorbar()
  35. plt.show()
  36. import cv2
  37. resize_scale = 10
  38. loaded_images_resized = np.zeros((loaded_images.shape[0], round(loaded_images.shape[1] / resize_scale), round(loaded_images.shape[2] / resize_scale)))
  39. for i in range(len(loaded_images)):
  40. loaded_images_resized[i] = cv2.resize(np.array(loaded_images[i], dtype='uint8'), (round(loaded_images.shape[2] / resize_scale), round(loaded_images.shape[1] / resize_scale)), interpolation=cv2.INTER_AREA)
  41. Xs = np.repeat(loaded_images_resized[:, :, :, np.newaxis], 1, axis=3)
  42. Xs = Xs/np.max(Xs)
  43. ys = crystal_system_label
  44. # synthetic data
  45. # noise
  46. noise = np.random.normal(0, 1, loaded_images.shape)
  47. loaded_images_noised = loaded_images + noise
  48. loaded_images_noised_resized = np.zeros((loaded_images.shape[0], round(loaded_images.shape[1] / resize_scale), round(loaded_images.shape[2] / resize_scale)))
  49. for i in range(len(loaded_images)):
  50. loaded_images_noised_resized[i] = cv2.resize(np.array(loaded_images_noised[i], dtype='uint8'), (round(loaded_images.shape[2] / resize_scale), round(loaded_images.shape[1] / resize_scale)), interpolation=cv2.INTER_AREA)
  51. Xt = np.repeat(loaded_images_noised_resized[:, :, :, np.newaxis], 1, axis=3)
  52. Xt = Xt/np.max(Xt)
  53. yt = ys
  54. from sklearn.preprocessing import OneHotEncoder
  55. one = OneHotEncoder(sparse_output=False)
  56. one.fit(np.array(ys).reshape(-1, 1))
  57. ys_lab = one.transform(np.array(ys).reshape(-1, 1))
  58. yt_lab = one.transform(np.array(yt).reshape(-1, 1))
  59. #%% Discriminator
  60. def get_discriminator():
  61. model = Sequential()
  62. model.add(Dense(10, activation='relu'))
  63. model.add(Dense(10, activation='relu'))
  64. model.add(Dense(1, activation="sigmoid"))
  65. # model.compile(optimizer=Adam(0.001), loss='mse')
  66. return model
  67. #%% Encoder
  68. class DeepResNet(tf.keras.Model):
  69. """Defines a multi-layer residual network."""
  70. def __init__(self, num_classes, kernel_size=2, num_conv2d_layers=3, num_dense_layers=3,
  71. num_conv2d_hidden=64, num_dense_hidden=64, dropout_rate=0.1, spec_norm_bound=0.9, **classifier_kwargs):
  72. super().__init__()
  73. # Defines class meta data.
  74. self.kernel_size = kernel_size
  75. self.num_conv2d_hidden = num_conv2d_hidden
  76. self.num_dense_hidden = num_dense_hidden
  77. self.num_conv2d_layers = num_conv2d_layers
  78. self.num_dense_layers = num_dense_layers
  79. self.dropout_rate = dropout_rate
  80. self.classifier_kwargs = classifier_kwargs
  81. self.spec_norm_bound = spec_norm_bound
  82. # Defines the hidden layers.
  83. self.input_layer = tf.keras.layers.Conv2D(filters=self.num_conv2d_hidden, kernel_size=self.kernel_size, trainable=False) #
  84. self.conv2d_layers = [self.make_conv2d_layer() for _ in range(num_conv2d_layers)]
  85. def call(self, inputs, return_latent=False):
  86. # Projects the 2d input data to high dimension.
  87. hidden = self.input_layer(inputs)
  88. # Computes the ResNet hidden representations.
  89. for i in range(self.num_conv2d_layers):
  90. resid = self.conv2d_layers[i](hidden)
  91. hidden = tf.keras.layers.MaxPooling2D((2,2), strides=1, padding='same')(resid) #
  92. hidden += resid
  93. hidden = tf.keras.layers.Flatten()(hidden)
  94. if return_latent:
  95. return hidden
  96. return hidden
  97. def make_conv2d_layer(self):
  98. """Uses the Conv2d layer as the hidden layer."""
  99. conv2d_layer = tf.keras.layers.Conv2D(filters=self.num_conv2d_hidden, kernel_size=self.kernel_size, strides=1, padding='same', activation='relu')
  100. return spectral_normalization.SpectralNormalizationConv2D(
  101. conv2d_layer, norm_multiplier=self.spec_norm_bound)#
  102. def get_encoder():
  103. resnet_config = dict(num_classes=1, kernel_size=(3,3),
  104. num_conv2d_layers=3, num_dense_layers=2,
  105. num_conv2d_hidden=32, num_dense_hidden=64)
  106. resnet_model = DeepResNet(**resnet_config)
  107. return resnet_model
  108. #%% Task
  109. # GP
  110. class DeepResNet_GP(tf.keras.Model):
  111. """Defines a multi-layer residual network."""
  112. def __init__(self, num_classes, num_layers=3, num_hidden=128,
  113. dropout_rate=0.1, **classifier_kwargs):
  114. super().__init__()
  115. self.classifier_kwargs = classifier_kwargs
  116. # Defines the output layer.
  117. self.classifier = self.make_output_layer(num_classes)
  118. def call(self, inputs):
  119. # Projects the 2d input data to high dimension.
  120. hidden = inputs
  121. return self.classifier(hidden)
  122. def make_output_layer(self, num_classes):
  123. """Uses the Dense layer as the output layer."""
  124. return tf.keras.layers.Dense(
  125. num_classes, **self.classifier_kwargs)
  126. # The SNGP model
  127. # Define SNGP model
  128. import sys
  129. import gaussian_process
  130. import spectral_normalization
  131. class DeepResNetSNGP(DeepResNet_GP):
  132. def __init__(self, spec_norm_bound=0.95, **kwargs):
  133. self.spec_norm_bound = spec_norm_bound
  134. super().__init__(**kwargs)
  135. def make_output_layer(self, num_classes):
  136. """Uses Gaussian process as the output layer."""
  137. return gaussian_process.RandomFeatureGaussianProcess(
  138. num_classes,
  139. gp_cov_momentum=-1,
  140. **self.classifier_kwargs)#nlp_layers.gaussian_process.
  141. def call(self, inputs, training=False, return_covmat=False):
  142. # Gets logits and a covariance matrix from the GP layer.
  143. logits, covmat = super().call(inputs)
  144. # Returns only logits during training.
  145. if not training and return_covmat:
  146. return logits, covmat
  147. return logits
  148. class ResetCovarianceCallback(tf.keras.callbacks.Callback):
  149. def on_epoch_begin(self, epoch, logs=None):
  150. """Resets covariance matrix at the beginning of the epoch."""
  151. if epoch > 0:
  152. self.model.classifier.reset_covariance_matrix()
  153. class DeepResNetSNGPWithCovReset(DeepResNetSNGP):
  154. def fit(self, *args, **kwargs):
  155. """Adds ResetCovarianceCallback to model callbacks."""
  156. kwargs["callbacks"] = list(kwargs.get("callbacks", []))
  157. kwargs["callbacks"].append(ResetCovarianceCallback())
  158. return super().fit(*args, **kwargs)
  159. def get_task():
  160. resnet_config = dict(num_classes=3, num_layers=6, num_hidden=128)
  161. sngp_model = DeepResNetSNGPWithCovReset(**resnet_config)
  162. return sngp_model
  163. #%% ADDA
  164. adda = ADDA(get_encoder(), get_task(), get_discriminator(),
  165. loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True), optimizer=Adam(0.00001, beta_1=0.5),
  166. copy=True, metrics=["acc"], random_state=0)
  167. adda.fit(Xs, ys_lab, Xt, yt_lab, epochs=100, batch_size=32, verbose=1);
  168. pd.DataFrame(adda.history_).plot(figsize=(8, 5))
  169. plt.title("Training history", fontsize=14); plt.xlabel("Epochs"); plt.ylabel("Scores")
  170. plt.legend(ncol=2)
  171. plt.show()
  172. sngp_logits, sngp_covmat = adda.task_(adda.encoder_.predict(Xt), return_covmat=True)
  173. sngp_variance = tf.linalg.diag_part(sngp_covmat)[:, None]
  174. sngp_logits_adjusted = sngp_logits / tf.sqrt(1. + (np.pi / 8.) * sngp_variance)
  175. sngp_probs = tf.nn.softmax(sngp_logits_adjusted, axis=-1)
  176. yt_pred = np.argmax(sngp_probs, axis=1)
  177. acc = accuracy_score(yt, yt_pred)

USEM.py at commit 1cf1101, no license · at the source

Overview

Authors: Jie Chen1,2,3, Timothy Long4, Michael Wall4, Todd Hufnagel4, Wei Chen5
  1. Department of Mechanical Engineering, Virginia Tech, Blacksburg, VA USA
  2. VT Made, Virginia Tech, Blacksburg, VA USA
  3. Macromolecules Innovation Institute, Virginia Tech, Blacksburg, VA USA
  4. Department of Materials Science and Engineering, Johns Hopkins University, Baltimore, MD USA
  5. Department of Mechanical Engineering, Northwestern University, Evanston, IL USA
Institutions: Virginia Tech (United States); Johns Hopkins University (United States); Northwestern University (United States)
Journal: Scientific reports, volume 16, issue 1, article 20837
Dates: received 10 January 2026; accepted 27 April 2026; published online 6 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41598-026-51212-8 · PMID 42091981 · PMCID PMC13338178 · OpenAlex W7160393613
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: computational modeling (no new data) (modality), none (in silico) (organism), computational (subfield)
Methods: Machine learning
Keywords: Machine learning, Uncertainty quantification, Domain adaptation, X-ray diffraction, Materials characterization, Engineering, Materials science, Mathematics and computing, Physics
Topic: Machine Learning in Materials Science (Materials Chemistry, Materials Science), according to OpenAlex
Funding: Army Research Laboratory (W911NF-22-0121)
Citations: not cited yet (Europe PMC); 63 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

jcj7292/USEM

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 1cf1101acf6c6d90304be85061c846294008a1f1, 16 December 2025
Languages: Python (1)
Size: 62 files, 1 script
Software Heritage: not archived
Found in: “Data availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Keras (1 file), Matplotlib (1 file), NumPy (1 file), OpenCV (1 file), pandas (1 file), scikit-learn (1 file), TensorFlow (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
2 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 1 script, each with its path and the digest of its content;
  • 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-51212-8.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 9 keywords, 1 funder, 17 references.

Cite

This paper

Chen, J., Long, T., Wall, M., Hufnagel, T., & Chen, W. (2026). Uncertainty aware machine learning for bridging simulation and experiment in high throughput materials characterization. Scientific reports, 16(1), 20837. https://doi.org/10.1038/s41598-026-51212-8

BibTeX

@article{chen2026uncertainty,
author = {Chen, Jie and Long, Timothy and Wall, Michael and Hufnagel, Todd and Chen, Wei},
title = {{Uncertainty aware machine learning for bridging simulation and experiment in high throughput materials characterization}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {20837},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-51212-8},
url = {https://doi.org/10.1038/s41598-026-51212-8},
pmid = {42091981},
pmcid = {PMC13338178}
}

RIS

TY - JOUR
AU - Chen, Jie
AU - Long, Timothy
AU - Wall, Michael
AU - Hufnagel, Todd
AU - Chen, Wei
TI - Uncertainty aware machine learning for bridging simulation and experiment in high throughput materials characterization
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/05/06
VL - 16
IS - 1
SP - 20837
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-51212-8
UR - https://doi.org/10.1038/s41598-026-51212-8
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-51212-8",
"type": "article-journal",
"title": "Uncertainty aware machine learning for bridging simulation and experiment in high throughput materials characterization",
"container-title": "Scientific reports",
"author": [
{
"family": "Chen",
"given": "Jie"
},
{
"family": "Long",
"given": "Timothy"
},
{
"family": "Wall",
"given": "Michael"
},
{
"family": "Hufnagel",
"given": "Todd"
},
{
"family": "Chen",
"given": "Wei"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "20837",
"DOI": "10.1038/s41598-026-51212-8",
"PMID": "42091981",
"PMCID": "PMC13338178",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-51212-8",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
6
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi: [code]
Going deeper with morphologically detailed neural networks by simulation-based gradient propagation
Journal: Frontiers in computational neuroscience
In common: Keras, TensorFlow, Matplotlib, 1 other tool, none (in silico), computational, computational modeling (no new data), 1 reference
[2] doi: [code]
Real-time closed-loop feedback system for mouse mesoscale cortical signal and movement control
Journal: eLife
In common: Keras, TensorFlow, OpenCV, 4 other tools
[3] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: Keras, TensorFlow, OpenCV, 4 other tools
[4] doi:10.1126/sciadv.aed3650 [code]
Truthful visualizations for mass spectrometry imaging enable high-spatial-resolution interactive <i>m/z</i> mapping and exploration.
Journal: Science advances
In common: Keras, TensorFlow, OpenCV, 4 other tools
[5] doi:10.1371/journal.pcbi.1014571 [code]
SynAPSeg: A novel dataset and image analysis framework for deep learning-based synapse detection and quantification.
Journal: PLoS computational biology
In common: Keras, TensorFlow, OpenCV, 4 other tools
[6] doi:10.1364/boe.605322 [code]
Generalized plaque digitization framework for multi-dimensional mesoscopic images.
Journal: Biomedical optics express
In common: Keras, TensorFlow, OpenCV, 4 other tools
[7] doi:10.1038/s41467-026-74769-4 [code]
Amphibian-inspired neuromorphic dynamic vision systems based on ferroelectric field-effect transistor.
Journal: Nature communications
In common: Keras, TensorFlow, OpenCV, 4 other tools
[8] doi:10.1002/epi.70296 [code]
Fully automated three-dimensional deep learning-based magnetic resonance imaging segmentation of brain cavities in epilepsy surgery.
Journal: Epilepsia
In common: Keras, TensorFlow, OpenCV, 4 other tools
[9] doi:10.1093/jnen/nlaf152 [code]
Clinical and pathologic correlations of machine learning quantification of Aβ deposits across 3 brain regions of decedents with Alzheimer disease.
Journal: Journal of neuropathology and experimental neurology
In common: Keras, TensorFlow, OpenCV, 4 other tools
[10] doi:10.1186/s12880-026-02481-2 [code]
Deep learning-based neuroanatomical profiling reveals population-specific brain changes in multiple sclerosis: a large-scale Middle Eastern study.
Journal: BMC medical imaging
In common: Keras, TensorFlow, OpenCV, 4 other tools

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.