Super-hierarchical and explanatory analysis of magnetization reversal process using topological data analysis

ABSTRACT The microstructures of magnetic domains are crucial in determining the functions of spintronic devices. However, the magnetization reversal mechanism is still not fully understood because of the difficulty in quantifying the drastic and complex changes in the magnetic domain structure. Here, we used topological data analysis and developed a super-hierarchical and explanatory analysis method for magnetic reversal processes. We quantified the complexity of a magnetic domain structure using persistent homology and visualized the magnetization reversal process in a two-dimensional space using principal component analysis. The first principal component (PC1) was a descriptor explaining the magnetization, and the second principal component (PC2) was a crucial descriptor characterizing the stability of the magnetic domain structure. Interestingly, PC2 detected slight changes in the structure, which indicates a hidden feature dominating the metastable/stable reversal processes. We successfully determined the cause of the branching of the macroscopic reversal process on the original microscopic magnetic domain structure. This super-hierarchical and explanatory analysis would improve the reliability of spintronics devices and understanding of stochastic/deterministic magnetization reversal phenomena. GRAPHICAL ABSTRACT


Introduction
The microstructures of magnetic domains are critical in characterizing the functions of various advanced magnetic devices. In the next generation of high-speed and high-density information devices, the reliability of data storage and writing speed processes will be determined by changes in microscopic magnetic domain structures [1][2][3][4]. Since 0/1 of bit is recorded as positive/negative magnetization, the precise control of the vortex core in magnetic domain structures is key to controlling the information in the racetrack memory or magnetoresistive random access memory (MRAM) of spintronics devices [5][6][7][8]. In addition, the magnetic domain structure in artificial spin ice has attracted significant attention for the realization of quantum computers [9][10][11]. The topological symmetry of magnetic nanowires causes fluctuations in the stability of magnetic moments, resulting in unique orders such as frustrated magnetism. In the motors of next-generation electric vehicles, understanding the magnetization reversal process is essential to reducing iron losses in electromagnetic steel sheets to improve their power generation efficiency [12][13][14]. Therefore, magnetic materials have a wide range of applications, such as information devices, quantum computing, and electric vehicles. They are extremely important for realizing a sustainable society [15]. Since these macroscopic magnetic functions are achieved by controlling the microscopic magnetic domain structures and stability of the magnetization reversal process, it is essential to develop an analytical method that can realize a hierarchy in materials and explain the origins of certain functions.
However, the magnetization reversal mechanism is not yet fully understood. In soft magnetic materials, even with similar macroscopic magnetic hysteresis, the reversal behavior of the microscopic magnetic domain structure frequently varies ( Figure 1). This raises concerns related to the reliability of information recording in MRAM and the hysteresis loss of electromagnetic steel plates in motors. Magnetic domain structures change complexly and drastically when an external magnetic field is applied to the system. The fine structure of the magnetic domain structure was determined by a delicate balance between demagnetization energy and exchange energy and was also affected by the magnetization processes. The resulting fine structures are not reproducible, and no quantitative index currently exists to evaluate the complexity of magnetic domain structures. Even in the fundamental permalloy (Py) magnetic nanodots, predicting whether a stable vortex magnetic domain or metastable double-vortices magnetic domain will be constructed has been difficult. Slight differences in Figure 1. Workflow of the super-hierarchical and explanatory analysis of the magnetization reversal process using TDA. First, we output the magnetic domain images of a Py magnetic nanodot using an LLG simulation. Two different magnetization reversal processes (stable and metastable) occur. Second, feature extraction from the magnetic domain structure is performed using PH, and a PD is outputted. Third, PCA is applied to the PDs, and the variation in the magnetic domain structure is visualized in a lowdimensional space. Finally, TDA is used to identify the microscopic position contributing to the macroscopic magnetization reversal process using eigenvectors.
precursor position are believed to contribute to this, but the cause-and-effect relationship is unclear [16,17]. Conventional analyses have only been conducted qualitatively by the human eye [18]. Therefore, a quantitative, explanatory, and super-hierarchical analysis method has not yet been realized. In addition, the magnetization reversal process is known as a complex phenomenon that involves both determinism and stochasticity, and a general solution involving electromagnetism and thermodynamics has not yet been found [19]. Appropriate analysis of changes in magnetic domain structure, which have been difficult to predict, is crucial not only for a basic understanding of the magnetization reversal mechanism but also for applications. The magnetic domain structure is a crucial determinant of the magnetization reversal process; nevertheless, until now, it has mainly been interpreted based on theoretical equations. However, when unknown information is included in the magnetic domain structure, it is useful to employ a datadriven approach, such as machine learning based on pattern recognition and data mining strategy. This is because machine learning can extract the features inherent in the data. It can also enable logical causal analyses based on the accumulated results of correlation analyses [20][21][22][23].
A Py magnetic nanodot is a typical soft magnetic material that exhibits complex magnetic phenomena [16,17]. By changing the external magnetic field of this system, a magnetic domain structure referred to as the flower pattern is obtained [16,17]. Then, the magnetization reversal path splits into two branches, constructing magnetic domain structures called the Sand C-states. When the magnetic field is set to zero, the C-state transitions to the Landau pattern with a single magnetic vortex, whereas the S-state forms a diamond pattern with two magnetic vortices. However, whether the flower pattern branches to the diamond pattern or Landau pattern has not been clarified from the standpoint of both theoretical simulation and experimental observation. In addition, the location of the branching in the microscopic magnetic domain structure remains unclear and inhibits the comprehension of the macroscopic magnetization reversal process [24][25][26]. Therefore, the magnetization reversal process is an essential unsolved issue related to both the application and fundamental understanding of these systems. It is necessary to develop a magnetic analysis method that can connect the macroscopic and microscopic characteristics of these systems in a super-hierarchical manner, as well as explain the mechanism of the magnetization reversal process. Herein, we consider magnetic domain structures as image information and execute a data analysis by actively using its heterogeneity; further, we attempt to develop a new analysis method for magnetic functions.
In this study, we demonstrate a method referred to as topological data analysis (TDA) to investigate the magnetization reversal phenomena in Py nanodots. TDA is a novel analysis method for constructing a super-hierarchical and quantitative linkage between microscopic fine structures and macroscopic physical properties. TDA, which uses a combination of a novel topological concept called persistent homology (PH) and machine learning, has attracted increasing attention in recent years [20]. PH is a powerful tool that can quantitatively describe the features (size, shape, fluctuation, and connectivity of holes and islands) of fine structures. Machine learning enables the construction of correlations between features and various physical properties [20][21][22][23]. Using dimensionality reduction via pattern recognition, changes in magnetic domain structures can be visualized in a low-dimensional space. Furthermore, TDA allows us to return from the eigenvector to the original image and visualize the positions that contribute to the macroscopic magnetization reversal process in the microscopic magnetic domain structure. Therefore, TDA can enable bidirectional and interpretable analyses of microstructural and macroscopic phenomena. Figure 1 shows the workflow of this study. In the first step, the magnetic domain structure was simulated for a typical soft magnetic material of Py square nanodot using the Landau -Lifshitz-Gilbert (LLG) equation as shown in Equation (1). The LLG equation is the only method that simulates the spatial distribution of magnetic moments, and its powerful capability has been verified experimentally through magnetization reversal processes for various magnetic nanodots [16,17,24]. Each pixel of the image records local magnetization information, and the external magnetic field is continuously scanned to generate a large-scale dataset of the magnetic domain structure. The data are also confirmed to reproduce the results of previous studies, in which two different magnetization reversal processes were generated [27,28]. In the second step, we used PH to extract features of the fine structure of the magnetic domain structure to output a persistence diagram (PD) [20][21][22]29]. As a pre-processing step, we took the absolute value of the perpendicular magnetic field to enhance the fine structures in the magnetic domain. We applied PH to extract the spatial distribution features of the magnetic moment in the domain structure, such as the Bloch walls, magnetic vortices, and fine structures inside the domain wall. The distributed generators in the PD record the information on the fine structure. In addition, the PD and magnetic domain structure are quantitatively and bidirectionally connected [20,23,[28][29][30]. In the third step, we used the principal component analysis (PCA), which is a simple unsupervised machine learning method that can visualize the intrinsic trends in high-dimensional data using a low-dimensional space.
The first principal component (PC1) uses an axis with the largest variance in the data. The second principal component (PC2) is determined as the next largest variance, which is orthogonal to PC1 [31,32]. PCA provides eigenvectors instead of explaining the structure of the dataset and discovers its changes as a linear combination. Although PCA is a simple machine learning method, it is useful for extracting the inherent or hidden features in a complex dataset and visualizing its trends. The eigenvectors of PCA are also necessary for performing super-hierarchical analysis connecting macro -micro properties. Such advantages of PCA could be useful for developing a highly interpretable analysis method. Because PH varies following changes in the magnetic domain structure, the relationship between the magnetization reversal process and the variation in the magnetic domain structure can be mapped and visualized in a low-dimensional space. In addition, the element of trained eigenvectors can be returned to the original image. Therefore, the positions contributing to the macroscopic magnetic reversal process can be visualized on the super-hierarchy of the microscopic magnetic domain structure. We focus on developing the fundamental principles of the analytical method based on a simulated magnetic domain structure; application to experimental magnetic domain structures is beyond the scope of this study owing to the noise in the experimental data. Herein, we demonstrate a TDA-based magnetic domain structure analysis to identify the factor dominating the branching of the magnetization reversal process, which has not yet been identified. We extract the quantitative features of the magnetic domain structure, investigate the hidden features contributing to the magnetization reversal process, and visualize these features on the original magnetic domain structure.

Micromagnetic simulations
The magnetic domain structure dataset was generated using Mumax3, a micromagnetic simulation software based on the -Landau-Lifshitz -Gilbert (LLG) equation [27]. The magnetic moment M i of each cell is treated as a classical spin and considered phenomenologically, as in Equation (1).
where, γ is the electron gyromagnetic ratio, and α is the phenomenological damping factor of magnetization. B eff i is a combination of the exchange interactions, demagnetizing field, and external magnetic field from the surroundings acting on this magnetic moment M i as an effective magnetic field. We used the physical parameters of Py (Ni 80 Fe 20 ). The saturation magnetization value was set to 8.6 × 10 5 A/m, the exchange stiffness was set to 1.3 × 10 −11 J/ m, and the magnetocrystalline anisotropy constant was set to K u = 0 J/m [33]. The system was set to a square geometry with a size of 1.2 μm × 1.2 μm × 80 nm (with a cell size of 4 × 4 × 4 nm). A random seeding number for the initial state was set to the same value for both the metastable and stable processes, and the initial magnetic domain structure was calculated until the total energy converged satisfactorily [27]. Next, a magnetic field was applied from 0 to 0.5 T in steps of 0.001 T until a saturated magnetic field was achieved, and the initial magnetization process was simulated. A magnetic field was then applied over the range of −0.5 to 0.5 T, in steps of 0.001 T, and calculations for one loop of the magnetic hysteresis curve were performed. A total of 2500 magnetic domain images were outputted. A magnetic domain image was outputted for the M x , M y , and M z components.

Computational persistent homology analysis
In this study, we adopted a PH analysis combined with machine learning and a visualization technique developed by Obayashi et al [20]. As a pre-processing step for the PH analysis, we used the absolute value of M z and normalized the intensity to 8 bits (ranging from 0 to 255). In the PH analysis, we performed filtration using the level-set method and outputted a PD with a zerodimensional PH. For filtration, we used a sublevel method, which extracts the features of darker pixels, and a superlevel method, which extracts the features of brighter pixels. We used HomCloud (https://homcloud. dev/index.en.html) for the PH analysis. We then performed the PH analysis, achieved a vectorized PD, and visualized the PD in real space [20].

Machine learning
In the PCA, we converted the PD to a PI. We set the dispersion in the PI as σ = 5.0, the mesh range as [0, 255], and the mesh size as 128, and we subsequently obtained an 8256-dimensional vector [20]. Vectorisation was performed for both the sublevel and superlevel, and 16,512-dimensional vector data were obtained by combining the respective vector data. This vector records both the birth and death information of islands in magnetic domain image. To analyze the dependence on the external magnetic field, 2000 vector data were acquired, excluding those corresponding to the initial magnetization process. The dataset was prepared for 2 different processes, metastable and stable, obtaining a 4000 × 16512 matrix. We performed the PCA for the matrix, and the dimensions of this matrix were reduced to the two principal components. The analysis was performed following reference 20. Note that we only used the PDs as PCA input and the magnetization was used only for the visualization and not for PCA. From PCA results, correlation analysis between eigenvalues and physical properties allows us to consider the physical meaning of the eigenvalues. In this work, PC1 is the feature that describes M and H, while PC2 describes the exchange energy (discussed in the Results and discussion section). Machine learning was performed in Python 3.6 with libraries using scikit-learn [32,34,35].

Magnetic domain structure achieved via micromagnetic simulations
We performed LLG simulations to generate a dataset of magnetic domain images and magnetic hysteresis curves, as shown in Figure 2. An external magnetic field was applied in the x-direction, and two different magnetization reversal processes were generated. We used the absolute value of the z component of the magnetization (M z ) in the magnetic domain image to enhance the fine structures of this system. The magnetization reversal process that constructs a diamond pattern is called the metastable process, while the one that constructs a Landau pattern is called the stable process. Figure 2(a) shows the magnetic hysteresis in the metastable/stable magnetization reversal processes. The metastable process is indicated by a rhombus marker, whereas the stable process is indicated by a square marker. The external magnetic field μ 0 H scans continuously from +0.5 to −0.5 T. It is shown that the magnetization of the nanodot reverses in the range of 0.25 to −0.25 T for both the metastable and stable processes. We focused on the region of magnetization reversal (black rectangle inset) and magnified this region, as shown in Figure 2  Under a magnetic field of approximately 0.043 T, a branch of the reversal process begins to occur. However, the metastable and stable states show a common flower pattern, and the differences in the magnetic domain structures cannot be recognized by the human eye. It is also difficult to confirm the differences between these states in terms of macroscopic magnetic hysteresis (Figures 2(c.3) and 2(d.3)). Under a magnetic field of 0.040 T, the magnetic domain structures construct the S-state (Figure 2  (c.3)) and C-state (Figure 2(d.3)) in the metastable and stable processes, respectively. Two different magnetization reversal processes occur between these two states. When the flower pattern becomes unstable, it changes stochastically to either the S-or C-state, as reported in a previous study [24]. We confirmed the reproducibility of the simulation, in which the magnetization reversal process branching occurs for a random seed of the initial state. Under a magnetic field of 0.025 T in a metastable process, the midway (S-D) magnetic domain structure is constructed between the S-state and the diamond pattern (Figure 2(c.5)). A midway (C-L) magnetic domain structure is constructed between the C-state and Landau pattern as a stable process (Figure 2(d.5)). The midway structures (Figures 2(c.5) and 2(d.5)) in the magnetic hysteresis are clearly distinguished, although the S-and C-states (Figures 2(c.4) and 2 (d.4), respectively) are not distinguishable. In the coercive field region of 0.000 T, two magnetic vortices with a 180° domain wall are generated in the metastable process, constructing the diamond pattern (Figure 2 (c.6)). One magnetic vortex with a 90° domain wall was generated in the stable process, constructing the Landau pattern (Figure 2(d.6)). All the above results correspond with those of previous studies. Therefore, we generated a dataset of metastable and stable magnetization reversal processes for use in the subsequent PH analysis [24,36,37]. Figure 3 schematically shows the analysis procedure of zero-dimensional PH (PH 0 ) using the level-set method. PH 0 allows us to quantify the complexity of a fine structure in grayscale images by evaluating the connectivity between pixels while varying the threshold. Figure 3(a) shows an 8-bit grayscale image as an example. We set a threshold for the brightness and created a binarized image setting in which white and black denote values higher and lower than the threshold value, respectively. Figure 3(b) shows a binarized image for thresholds of 255, 128, and 0. At a threshold of 255, five islands of white pixels are generated; when the threshold is lowered to 128 via filtration, the white islands expand while connecting the three neighboring islands, and two islands remain. At a threshold of zero, the image becomes completely white, and one island is present. Figure 3(c) illustrates the creation of a zerodimensional PD (PD 0 ) using the level-set method. The threshold generating the white island is defined as birth on the vertical axis, whereas the threshold connecting and dying the island is defined as death on the horizontal axis. Multiplicity is used as an indicator for connectivity, which is defined as the difference between the number of generated and remaining islands (i.e. the number of dying islands). In the sample image, five islands are generated at a threshold of 255. These islands connect at a threshold of 128, and three small islands are connected and absorbed into the neighboring islands, resulting in two remaining islands. Next, the generator is plotted as (birth, death) = (255, 128), and the multiplicities are plotted as a value of three (Figure 3 (c.1)). At a threshold of 0, the two remaining islands are connected, and one island remains. In the same manner, the generator is plotted at (birth, death) = (255, 0), and the multiplicity is plotted to correspond to a value of one (Figure 3  (c.2)). The difference between birth and death is defined as the lifetime, and a larger lifetime indicates a more robust structure. This intuitively corresponds to a higher intensity in the grayscale shading in the fine structure. Figure 3(d) shows the relationship between the generator and the original image in PH 0 . The generator at (birth, death) = (255, 128) with a multiplicity of 3 corresponds to three green islands. In the same manner, the generator at (birth, death) = (255, 0) with a multiplicity of 1 corresponds to one blue island. Therefore, PD 0 quantitatively evaluates the complexity of the fine structures of grayscale images, and the feature and image spaces are bidirectionally connected [30,38]. At saturation (Figure 4(a)), the entire area of the magnetic dot is grey, indicating that almost no magnetization is present in the perpendicular component, and no generator is shown in PD 0 (Figure 4(d)). In the flower pattern (Figure 4(b)), the edge of the dot is magnetized by the perpendicular component, and PD 0 for this pattern (Figure 4(e)) shows the concentration of generators in the three regions of birth near 0, 80, and 128. In the S-state (Figure 4(c)), an obvious magnetic wall (i.e. the Bloch wall) is generated, and in the PD 0 plot (Figure 4(F)), the concentration of the generator can be seen in two regions of birth, at 0-64 and 120-150. Similarly, in the C-state (Figure 4(d)), a clear magnetic wall is generated, and the concentration of the generator can be seen in two regions of birth, at 0-64 and 120-150 in the PD 0 plot (Figure 4(j)). By comparing the PD 0 plots of the S-and C-states, we can also confirm a subtle difference in the distribution of the generators. In the diamond pattern (Figure 4(h)), the complexity of the magnetic domain image increases, leading to the construction of double vortices. Here, the generators are distributed throughout the entire area in the PD 0 plot (Figure 4(k)). In the Landau pattern (Figure 4(i)), a single vortex is constructed, and the concentration of generators can be confirmed in the regions where the death and birth lie within the range 0 to 64 in the PD 0 plot (Figure 4(j)). In particular, the generators are concentrated in the region of a small lifetime (i.e. on the diagonal line). Comparing the diamond and Landau patterns, the distribution of generators is clearly distinguishable as a feature space in the PD 0 plots. These results indicate that PD 0 changes according to variations in the magnetic domain image. The different distributions of the This method allows us to quantify the complexity of the fine structures in grayscale images by evaluating the connectivity between pixels while varying the threshold. Five islands are generated at a threshold of 255. These five islands connect at a threshold of 128, and two small islands are connected and absorbed into the larger island, resulting in two remaining islands. The generator is then plotted as (birth, death) = (255, 128), and the multiplicity value becomes 3, as shown (c.1) in Figure 3(c). The birth and death coordinates express the robustness of the islands, and the multiplicity is a measure of the connectivity between islands. (d) Relationship between the generator and original image in PH 0 . It is confirmed that the green islands generate and die at (birth, death) = (255, 128) with a multiplicity of 3. In this manner, PD 0 quantitatively evaluates the complexity of the fine structures of grayscale images. Moreover, PD 0 and the original image are connected bi-directionally.

Feature extraction from the magnetic domain structure using persistent homology
generators express the differences in the magnetic domain images. A detailed explanation of PD 0 is provided in the supplementary material. PD 0 can extract features including the Bloch wall, magnetic distribution near the vortex, and fine structures inside the magnetic wall ( Figure S1) [28]. Therefore, it is concluded that PD 0 is a valuable vector for describing the differences in the fine structures in magnetic domain images.

Visualization of the magnetization reversal process via PCA
We performed a dimensionality reduction of highdimensional data composed of PDs using PCA. We also visualized the magnetization reversal process in a two-dimensional space [31,32]. PCA is one of the simplest dimensionality reduction algorithms, and it is highly interpretable and can be used to visualize the relationship between eigenvectors and physical properties. The eigenvector with the largest variance in the data is used as PC1. The eigenvector with the next largest variance that is orthogonal to the first principal component is used as PC2. We converted PD 0 to vector data using a persistence image (PI). PCA reduces dimensionality while preserving the Euclidean distance between the data points. Figure 5 shows the results of the dimensionality reduction achieved using PCA. The coordinates of the data points represent the eigenvalues of each eigenvector, and the larger eigenvalues correspond to a larger distance from the centroid. We indicated the |M| information of the nanodot using the colored data points. It should be noted that |M| is not used in machine learning. In this scatter plot, the red lines with diamond-shaped plot points correspond to the metastable magnetization reversal processes, and the blue lines with square plot points correspond to the stable magnetization reversal processes.
Next, we analyze the variation of the magnitude and positive/negative values of the eigenvalues (coordinates), as well as the variation of the eigenvectors of each principal component shown in this scatter plot. The coordinates and magnetization of the data points change continuously in both magnetization reversal processes. In addition, a large jump appears from the C-state to midway (C-L) in the data points. This corresponds well to the substantial change in the magnetic domain structure of the Barkhausen jump [39]. Considering the magnetization reversal process shown in Figure 5, the saturation and flower pattern conditions are shown at the same position. After undergoing branching, the magnetization reversal process splits into two, and a significant difference appears according to the different magnetization reversal processes. In the metastable process from midway (S-D) to the diamond pattern, the data points move from the bottom to the top of the scatter plot. In the stable process from midway (C-L) to the Landau pattern, the data points move from the top to the bottom of the scatter plot. The trend of data change suggests that the positive/negative signs of PC2 may be correlated with the metastable/stable magnetization reversal processes. The cumulative contribution of PC1 and PC2 was 99%, indicating a good reduction. We examined the reproducibility of the scatter plot for three different random seeds in the micromagnetic simulation. The reproducibility of the dimensionality reduction results, eigenvectors, and eigenvalues from the PH and PCA analyses ( Figure S2) was verified. The total computation time for all the analyses was 6 days. The scatter plots of PCA were almost identical and reproducible. The positions of flower, branch, diamond, and Landau were also reproduced. The PDs of PC1 and PC2 were almost identical. Therefore, the dimensionality reduction results are reproducible, suggesting that PC1 and PC2 could be the intrinsic vectors characterizing the stable/metastable process of magnetization reversal. PCA with PH could visualize the magnetization reversal process in a lowdimensional space reasonably. As a comparison, the direct PCA analysis using the brightness of the pixel of the magnetic domain image showed that the cumulative contribution of PC1 and PC2 was only 49.5%, indicating that the differences between midway (S-D) and the Landau pattern could not be distinguished via direct PCA ( Figure S3(a)). Therefore, PH and PCA can extract the features of the magnetic domain structure and visualize the magnetization reversal process in a low-dimensional space, which has been difficult to achieve using conventional image analysis techniques.
Next, we comprehensively analyzed the correlation between PC1-PC4 and the major physical quantities to discuss the physical meaning of the eigenvectors (Figure 6(a)). We selected magnetization, total energy, demagnetization energy, exchange energy, and dispersion of the magnetic domain image as the physical quantities. The energy change and dispersion of the system are useful in discussing the stability of the magnetization reversal process. These physical parameters were obtained by the LLG simulation directly and were not used in machine learning. PC1 had a strong negative correlation with magnetization. The Pearson correlation coefficient between PC1 and |M| was −0.932, suggesting that PC1 could be an appropriate vector for describing |M|. This result can be explained from the viewpoint of magnetism, as magnetization varies during the magnetization  Figure 2. After undergoing branching, the magnetization reversal process splits into the metastable and stable processes. Finally, the diamond and Landau patterns are constructed.
reversal process. PC2 showed the strongest positive correlation with the exchange energy, with a global upward trend in the region above 1 × 10 −16 J. The difference in exchange energies in the stable and metastable processes is evident, indicating that the two magnetization processes can be classified. This implies that PC2 could detect a minor difference in the exchange energy, suggesting that PC2 is a useful feature for describing the stability of the system. According to the conventional theory of magnetic domain formation, in metastable processes, multidomain structures are formed and the amount of magnetic walls increases, leading to an increase in the exchange energy. While the demagnetization energy is almost the same, the total energy increases; thus, the system turns unstable. This classical explanation is consistent with the machine learning results.
We attempted to describe the stability of the system using the variance (σ 2 ) of the magnetic domain images and analyzed its correlation with PC2 ( Figure 6(b)). The variance represents the dispersion of the histogram of the magnetic domain image. Since variance is given by the square of the magnetization, its dimension, by electromagnetic definition, corresponds to energy. Thus, the variance can be considered as a probability distribution function of the energy available, and it can describe the instability of the system. PC2 was positively correlated with variance, with a steady upward trend. This trend was similar to that in the case of exchange energy. The stable process has a small variance, while the metastable process has a large variance, suggesting that the data points are classifiable. From the viewpoint of image information, the variance of the image captures the amount of magnetic walls formed in the multidomain structure. This is consistent with the earlier discussion on exchange energies and stability, confirming that PC2 can describe not only the differences in the magnetization reversal process but also the energetic stability of the system.
The path of magnetization reversal is almost the same up to the branch, S-state, and C-state. Then, variance (and exchange energy) increases continuously in the metastable process, leading to the diamond pattern. In the stable process, variance (and exchange energy) increases up to the intermediate stage but then decreases and finally settles to the Landau pattern. Notably, the diamond and Landau patterns correspond to positive and negative signs of PC2, respectively. This suggests that PC2 is a feature describing the exchange energy and instability of the system. The metastable and stable magnetization process after branching correlate with the positive and negative sign of PC2. PC2 is a useful feature for describing the stability of the magnetization process. Interestingly, the stability of the system can be extracted without using the energy term as input for machine learning. Strong correlations were not observed after PC3. Since we have not normalized the axes in our PCA analysis, we can discuss the changes in the features (i.e. changes in magnetic domain structure) quantitatively. In Figure 5, PC1 shows a large change from −5 to 80, while PC2 shows a relatively small change in the range of ±4. From the discussion in Figures 5 and 6, PC1 correlates with magnetization, while PC2 correlates with exchange energy. Thus, the magnetization reversal process in Figure 5 splits into two, with the magnetization significantly changing while the exchange energy subtly fluctuates. This behavior might reflect the fluctuations in the magnetization reversal process and provide important insights for developing further functional analysis models.
We also considered the branching process, at which point this system splits into two types of magnetization reversal processes. We analyzed the difference in PD 0 between the metastable and stable processes at the branching point as well as that in the direct image ( Figure 7). Figure 7(a) shows the difference between the pixels of the domain image for the metastable and stable processes. Here, it is shown that minor differences exist between pixels in the region around the magnetic domain wall structure of the flower pattern, but it is difficult to clearly identify the differences that characterise the branching of the magnetization reversal process. Figure 7(b) shows the PD 0 for this system, which indicates the difference between the PD 0 plots of the metastable and stable processes. The difference in PD 0 is thought to reflect slight differences in the shapes of the magnetic domain structures. This could be a valuable feature for characterizing the branching of the magnetization reversal process. Again, the reproducibility of these results was confirmed using different random seeds.
Finally, we visualized the eigenvectors (PC1 and PC2) on the original magnetic domain structure and analyzed the correspondence between the PD and image. The generators in the PD can be used to visualize the area coordinates in the magnetic domain structure in a backward manner. PH can be used to visualize various microstructures, such as the Bloch wall, microstructures inside the domain wall, and fluctuations around the domain wall ( Figure S1). Figure 8(a) shows the expression of PC1 in the PD. Strong multiplicity signals appear in the range of 0 to 100, both at birth and death for PC1. By considering the maximum multiplicity region in PC1 and visualizing the generators on the domain image, two vortex cores in the diamond pattern (Figure 8(c.1)) and one vortex core in the Landau pattern (Figure 8(c.2)) are revealed. Therefore, PC1 indicates the state of the magnetic vortex core in addition to magnetization. The formation of the vortex core requires the construction of a flux-closure magnetic domain, and the net in-plane magnetic moment approaches zero. These findings indicate that PC1 correlates with the magnetization of this system [28]. Figure 8(b) shows the PD reconstructed using PC2, showing the distributions of both the positive and negative regions, which we visualized as the red and blue generators, respectively. We analyzed the correspondence between PC2 and magnetization reversal processes. In both processes, there is no difference considering the generators in the flower pattern (Figure 8(c.2) and 8(d.2)). In the metastable process (Figure 8(c)), positive generators appear on the domain wall at the branching point (Figure 8(c.3)), and the number of positive generators increases, leading to the metastable state of the diamond pattern (Figure 8(c.5)). Conversely, in the stable process (Figure 8(d)), the positive generator does not appear on the domain wall at the branching point (Figure 8  (d.3)). Negative generators appear around the domain wall at the branching point (Figure 8(d.3)). Although positive generators appear temporarily, the number of negative generators remains dominant, and the system finally reaches the stable state of the Landau pattern (Figure 8(c.5)).
Our analysis is focused on the maximum and minimum values of PC2. The maximum value of PC2 is distributed at (birth, death) = (160, 158), and the minimum value is distributed at (birth, death) = (40,38) and (38,36) (Figure 6(b)). These generators show a high multiplicity with a short lifetime, which corresponds to small islands with a high brightness contrast, as explained in Figure 3(c.1). From the standpoint of magnetic domain formation, this means that the direction of the magnetic moment rotates drastically, capturing the fine structure around the magnetic domain wall. It is also suggested that PC2 reflects the loss of magnetic energy caused by the rotation of the magnetic moment. In fact, in both the diamond and Landau patterns, the fine structure inside the Bloch wall, where the magnetic moment rotates continuously, has been adequately captured (Figure 8(c.5), (d.5)). These results are consistent with the results shown in Figure S4. The positive generators are visualized on the 180° wall of the diamond pattern, and the negative generators are visualized on the 90° wall of the Landau pattern ( Figure S4). The theory of magnetic domain formation states that 90° walls are energetically more stable owing to the smaller rotation of the magnetic moment [28]. This suggests that PC2 corresponds well to the energy loss around the magnetic domain wall and is a useful feature for explaining the stability of the magnetic domain structure. This result was verified to be reproducible using random seeds. Further, it confirms that the PH analysis can capture the branching of the magnetization reversal process, and the positive and negative signs of PC2 describe the stability of the magnetic domain structure. For comparison, we performed direct PCA analysis on the magnetic domain images. However, we could not obtain any information from PC1 or PC2 that would assist in determining the stability or branching of the reversal processes ( Figure S3). We suggest that TDA could be used to discover hidden features that cannot easily be detected visually in the magnetic domain and further analyze the complex magnetization reversal process.
The above results suggest that TDA is a valuable method for investigating the mechanism of complex magnetization reversal processes by detecting slight differences in the magnetic domain structure. Interestingly, PH can be used to investigate the slight differences in the fine structures near the branching point, while PD 0 can be used to investigate hidden features that cannot be extracted using conventional image analysis [40,41]. We succeeded in detecting the branching of the

Data availability statement
All datasets are available from the corresponding author upon reasonable request.

Code availability
The open-source HomCloud code used in this work is available on the following link: https://homcloud.dev/ index.en.html