# X-ray Diffraction Data Analysis by Machine Learning Methods--A Review
## 4 Applications of Machine Learning in XRD Data Analysis
### Pattern Matching and Classification Algorithms
\begin{table}
\begin{tabular}{p{56.9 pt} p{56.9 pt} p{56.9 pt}} \hline
**Group Number** & **Group Attributes** & **Labels** \\ \hline G1 & Experiments & GIWAXS, GISAXS, TSAXS, TWAXS, GTSAXS, Theta sweep, and phi sweep. \\ G2 & Instrumentation & Beam off image, photonics CCD, MarCCD, Linear beamstop, saturation, asymmetric (left/right), and circular beamstop. \\ G3 & Imaging & Specular rod, weak scattering, 2D detector obstruction, strong scattering, saturation artifacts, misaligned, beam streaking, blocked, bad beam shape, direct, object obstruction, empty cell, parasitic slit scattering, and point detector obstruction. \\ G4 & Scattering Features & Horizon, peaks: isolated, ring: oriented z, halo: isotropic, ring: isotropic, ring: textured, higher orders: 2 to 3, ring: oriented xy, vertical streaks, peaks: many/field, diffuse high-q: isotropic, higher orders: 4 to 6, higher orders: 7 to 10, Bragg rods, ring: anisotropic, peaks: along ring, diffuse low-q: isotropic, Yoneda, halo: oriented z, high background, ring: spotted, peak: line Z, peaks: line xy, diffuse low-q: anisotropic, many rings, diffuse low-q: oriented z, diffuse low-q: oriented xy, diffuse specular rod, smeared horizon, symmetry ring: 4-fold, higher orders: 10 to 20, ring doubling, halo: anisotropic, specular rod peaks, ring: oriented other, peaks: line, diffuse high-q: oriented z, peak doubling, halo: oriented xy, diffuse high-q: oriented xy, peaks: line other, waveguide streaks, higher orders: 20 or more, substrate streaks/Kikuchi, diffuse low-q: oriented other, halo: spotted, diffuse low-q: spotted, and diffuse high-q: spotted. \\ G5 & Samples & Thin film, ordered, single crystal, grating, amorphous, composite, nanoporous, powder, and polycrystalline. \\ G6 & Materials & Polymer, block–copolymer, and superlattice. \\ G7 & Specific Substances & P3 HT, SiO\({}_{2}\), PCBM, rubrene, PS-PMMA, silicon, MWCNT, PDMS, AgBH, and LaB\({}_{6}\). \\ \hline \end{tabular}
\end{table} 
Table 1: Attributes groups to be identified from synchrotron data streams images. Data from reference [91]. [PERSON] and [PERSON] [93; 94] compared several algorithms (RF, KNN, decision tree, SVM, and gradient boosting) with the CNN for the purpose of the classification of crystal systems into seven categories: triclinic, monoclinic, orthorhombic, tetragonal, hexagonal, rhombohedral, and cubic. The training dataset consisted of 164 compounds extracted from the Inorganic Crystal Structure Database with a similar composition, expected crystal symmetry, and space group. Their work showed that the CNN performed better than the other studied algorithm achieving a cross-validation accuracy for crystal system classification of 95.6% as compared to 55% for naive Bayes, 64.3% for KNN, 68.5% for logistic regression, 56.5% for RF, 45.6% for decision trees, 67.1% for SVM, 62.3% for decision trees and 65.4% for deep neural network. [PERSON] et al. [95] explored RF and CNN to distinguish between perovskite and non-perovskite-type materials in a series of hybrid lead halides. The synthetic (simulated) dataset was based on 998 crystal structures from the Cambridge Structural Database: 375 perovskite-type compounds (50 chlorides, 105 bromides, and 220 iodides) and 623 non-perovskite-type compounds (50 chlorides, 139 bromides, and 426 iodides). The study also used experimentally measured X-ray powder diffraction data on 23 freshly prepared lead halides: 9 previously published (and reported in Cambridge Structural Database) and 14 new compounds. The categories used for the classification were perovskite and nonperovskite. On the one hand, in the RF algorithm, the number of trees was set to 100, with a maximum of 10 levels in tree, a minimum number of 2 samples on a leaf, a minimum number of samples to split a node of 10, and a step size for the XRD patterns of 2.18\({}^{\circ}\). On the other hand, the CNN was designed with 23 layers and simulated patterns acted as 1D input. The mean values of the accuracy obtained after the classification were 0.92 in the case of CNN and 0.89 in the case of RF.