See classification using ResNet-50 neural network here: https://community.wolfram.com/groups/-/m/t/3202949
ABSTRACT (original article): Asphaltenes are organic compounds that aggregate in crude oil with two dominant molecular architectures: archipelago and continental. Continental architectures possess a single uniform island structure composed of aromatic rings in contrast to archipelago architectures with aromatic cores interconnected through aliphatic chains. The structural composition of asphaltenes varies globally due to geographical differences, posing challenges in their classification due to a lack of uniformity. This study is the first known exploration of using image-based supervised machine learning, particularly the ResNet-50 neural network, for the binary classification of asphaltenes into continental and archipelago motifs. 255 continental and archipelago models underwent structural augmentations to create a sample size of 1,530 asphaltene structures that is robust enough for accurate results in both the training and testing portions of the machine learning. These augmentations included the repeated addition of carbons until a complete pentane chain was added to a specified carbon on each asphaltene structure. Using Mathematica, supervised ResNet-50 image-based classification was used on both original and augmented structure datasets to classify as either archipelago or continental. The classification was also implemented using topological similarity searching for association between atoms and the distance between them for further molecule identification. This study demonstrates the surprising effectiveness of image-based classification compared to traditional topological feature-based methods. Our results reveal that deep learning techniques, especially image-based approaches, provide novel and insightful ways to differentiate complex molecular structures like asphaltenes, challenging the traditional reliance on topological features alone. This research opens new avenues in chemical analysis and molecular characterization, highlighting the potential of machine learning in complex molecular systems. CITATION (original article): Arun K. Sharma, Selsela Arsala, James Brady, Madison Franke, Shelby Franke, Supreet Gandhok, Simon-Olivier Gingras, Ana Gomez, Katelyn Huie, Kayla Katz, Samantha Kozlo, Mateo Longoria, Levi Molnar, Nathaly Peña, Sarina Regis, Machine learning to identify structural motifs in asphaltenes, Results in Chemistry, 7, 2024, 101551, https://doi.org/10.1016/j.rechem.2024.101551.
Introduction
Introduction
Asphaltenes are organic compounds that aggregate in crude oil with two dominant molecular architectures : archipelago and continental. Continental architectures possess a single uniform island structure composed of aromatic rings in contrast to archipelago architectures with aromatic cores interconnected through aliphatic chains. The structural composition of asphaltenes varies globally due to geographical differences, posing challenges in their classification due to a lack of uniformity. This study is the first known exploration of using image - based supervised machine learning, particularly the ResNet - 50 neural network, for the binary classification of asphaltenes into continental and archipelago motifs. 255 continental and archipelago models underwent structural augmentations to create a sample size of 1, 530 asphaltene structures that is robust enough for accurate results in both the training and testing portions of the machine learning. These augmentations included the repeated addition of carbons until a complete pentane chain was added to a specified carbon on each asphaltene structure. Using Mathematica, supervised ResNet - 50 image - based classification was used on both original and augmented structure datasets to classify as either archipelago or continental. The classification was also implemented using topological similarity searching for association between atoms and the distance between them for further molecule identification. This study demonstrates the surprising effectiveness of image - based classification compared to traditional topological feature - based methods.
Import files
Import files
Import all structures
Import all structures
In[]:=
SetDirectory[NotebookDirectory[]]
In[]:=
contis=Import["./Continentals-Augmented-5-Edits-Complete.mx"];
In[]:=
archis=Import["./Archipelagos-Augmented-5-Edits-Complete.mx"];
In[]:=
Length/@{contis,archis}
Out[]=
{1116,414}
Options for all plots
Options for all plots
In[]:=
Needs["StatisticalPlots`"];SetOptions[{PairwiseScatterPlot,ArrayPlot,MatrixPlot,ListLinePlot,ListPlot,Histogram,BarChart,BoxWhiskerChart,DistributionChart,BubbleChart,PairedHistogram},BaseStyle->{FontFamily->Times,FontSize->12,FontColor->Black},LabelStyle->{FontFamily->Times,FontColor->Black},FrameStyle->Black];
Classify the molecules into Archipelago and Continental through topological features
Classify the molecules into Archipelago and Continental through topological features
Import and label molecules
Import and label molecules
In[]:=
archiLabels=Thread[archis->"archi"];
In[]:=
contiLabels=Thread[contis->"conti"];
In[]:=
Length/@{archiLabels,contiLabels}
Out[]=
{414,1116}
Prepare multiple training and testing Sets
Prepare multiple training and testing Sets
Repeat the training specified number of times.
In[]:=
numberIndependentSets=10;archiSets=Table[ResourceFunction["TrainTestSplit"][archiLabels],numberIndependentSets];(*Allthefirstlistsaretrainingandthesecondonesaretesting*)
In[]:=
contiSets=Table[ResourceFunction["TrainTestSplit"][contiLabels],numberIndependentSets];(*Allthefirstlistsaretrainingandthesecondonesaretesting*)
Gather all the archipelago training sets
In[]:=
archiTrainings=archiSets[[All,1]];
Gather all the archipelago testing sets
In[]:=
archiTests=archiSets[[All,2]];
Gather all the continental training sets
In[]:=
contiTrainings=contiSets[[All,1]];
Gather all the continental testing sets
In[]:=
contiTests=contiSets[[All,2]];
Join all the archipelago and continental training sets to create asphaltene training sets.
In[]:=
asphalteneTrainingSets=RandomSample/@Flatten/@Transpose[{archiTrainings,contiTrainings}];
Join all the archipelago and continental testing sets to create asphaltene testing sets.
In[]:=
asphalteneTestingSets=RandomSample/@Flatten/@Transpose[{archiTests,contiTests}];
Verify that all sets are composed of the same length
In[]:=
Length/@asphalteneTrainingSets
Out[]=
{1224,1224,1224,1224,1224,1224,1224,1224,1224,1224}
In[]:=
Length/@asphalteneTestingSets
Out[]=
{306,306,306,306,306,306,306,306,306,306}
Train Classifier on each training set.
Train Classifier on each training set.
Use the FeatureExtractor for topological features of molecules.
In[]:=
trainedNetsTopologyClassifier=Classify[#,FeatureExtractor->"MoleculeTopologicalFeatures",TargetDevice->"GPU",PerformanceGoal->"Quality"]&/@asphalteneTrainingSets;
Classifier Information
Classifier Information
In[]:=
classifierMethods=Information[#]["Method"]&/@trainedNetsTopologyClassifier
Out[]=
{LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression,LogisticRegression}
In[]:=
learningCurvesDynamicObjects=Information[#]["LearningCurve"]&/@trainedNetsTopologyClassifier
Out[]=
,,,,,,,,,
Time needed to classify one example
Full method option to be reused in a new training
Classifier Measurements
Classifier Measurements
Fraction of correctly classified examples
Fraction of incorrectly classified examples
F1 score for each class, more sense if you are analyzing each network in more detail
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Machine learning to identify structural motifs in asphaltenes through Topological features
by Arunkumar Sharma
Wolfram Community, STAFF PICKS, July 1, 2024
https://community.wolfram.com/groups/-/m/t/3202910
by Arunkumar Sharma
Wolfram Community, STAFF PICKS, July 1, 2024
https://community.wolfram.com/groups/-/m/t/3202910