Sunspots are darker areas on the Sun’s photosphere and most of solar eruptions occur in complex sunspot groups. The Mount Wilson classification scheme describes the spatial distribution of magnetic polarities in sunspot groups, which plays an important role in forecasting solar flares. With the rapid accumulation of solar observation data, automatic recognition of magnetic type in sunspot groups is imperative for prompt solar eruption forecast. We present in this study, based on the SDO/HMI SHARP data taken during the time interval 2010-2017, an automatic procedure for the recognition of the predefined magnetic types in sunspot groups utilizing a convolutional neural network (CNN) method. Three different models (A, B, and C) take magnetograms, continuum images, and the two-channel pictures as input, respectively. The results show that CNN has a productive performance in identification of the magnetic types in solar active regions (ARs). The best recognition result emerges when continuum images are used as input data solely, and the total accuracy exceeds 95%, for which the recognition accuracy of Alpha type reaches 98% while the accuracy for Beta type is slightly lower but maintains above 88%.

1. Introduction

In 1908, Hale used the principle of the Zeeman effect to calculate the magnetic field strength inside sunspots and found that it is stronger than that of the surrounding area [1]. Because the convection in the magnetized plasma is suppressed by the strong magnetic field, temperature and radiation of sunspots are lower than those of their surroundings. Sunspots appear as dark areas in the white light images and are relatively temporary phenomena that can last for a few days to several weeks or even months. A well-developed sunspot is composed of a dark center and a lighter black part around it. The former is the umbra and the latter is the penumbra. As one kind of noticeable phenomena, sunspots not only represent the overall level of solar activities in a certain period, but also give clues to reveal other solar events.

Solar flares are one of the most violent phenomena occurring in the solar atmosphere. Long-term observations show that most of solar flares appear above sunspot groups. However, the mechanism that causes solar flares is far from fully understood. Numerous literatures have focused on the relationship between sunspot groups and solar flares [29]. The characteristics of sunspot groups are important factors for forecasting solar flares. Practically, many parameters, including magnetic gradient, magnetic shear, sunspot numbers, the Zernike moments of magnetograms, and McIntosh sunspot classifications, have been used [1013]. In particular, the morphology, that is, magnetic type of sunspot groups, has always been an important perspective in the prediction of solar flares. Atac (1987) [14] found that the sunspots producing large flares are of type Dki or Eki with magnetic class D. McIntosh (1990) [15] suggested a 3-component McIntosh classification to describe the complexity of sunspots, yielding the establishment of an expert system for predicting X-ray solar flares. S. Eren et al. (2017) [16] investigated the sunspot and solar flare data from 1996 to 2014, covering a total of 4262 active regions (ARs). Their results showed that large and complex sunspot groups have the flare-production potential about eight times higher than that of small and simple ARs.

Nowadays, both identification and classification of sunspots are mainly carried out manually by experts, which is a subjective, time-consuming, and labor-intensive process. On the other hand, the increasing number of space missions has led to a rapid accumulation of solar activity data set. Therefore, it has been on the agenda for quite a while to implement automatic identification procedures for sunspot magnetic types. Although much work has been done on the automatic recognition of sunspots [1719], there are few on automatic classification of sunspot magnetic types by machine learning method. Sinh Hoa Nguyen et al. (2005) [20] applied hierarchical learning method based rough set theory to the problem of classifying sunspots from satellite images. Trung Thanh Nguyen et al. (2006) [21, 22] used machine learning techniques to classify sunspot groups based on the seven-class Modified Zurich scheme. Colak et al. (2008) [23] adopted image processing algorithms and fully connected neural networks to automatically detect and classify sunspots based on the McIntosh classification system. Mehmmood A. Abd et al. (2010) [24] employed Support Vector Machines to achieve automatic classification of sunspot groups on full disk white light solar images. Sreejith Padinhatteeri et al. (2016) [25] have suggested a system called Solar Monitor Active Region Tracker-Delta Finder, which has a good performance on δ magnetic type recognition. However, the Mount Wilson classification in sunspot groups is lacking of overall automatic identification procedures.

In this work, based on the Mount Wilson classification system, the magnetic types of ARs are labeled by one of the unipolar group Alpha, the bipolar group Beta, and other complex multipole groups, Beta-x. These three magnetic types are identified automatically by using the convolutional neural network (CNN) method with SDO/HMI data taken during the time interval 2010-2017. A training model with high recognition accuracy is obtained. The paper is organized as follows: the Mount Wilson magnetic classification is briefly described in Section 2; both the data source and the preprocessing method are explained in Section 3; the structure of CNN is illustrated in Section 4 together with the training results of models using different input data; Section 5 concludes the paper.

2. Mount Wilson Sunspot Classification Scheme

In 1919, the Mount Wilson Observatory in California developed a classification scheme of sunspots according to the polarity of the corresponding magnetic fields [26]. It considers bipolar sunspot groups as a basic type, and other types are regarded as deformations of the bipolar sunspot group. The category is listed below (https://www.spaceweatherlive.com):(1)Alpha: a unipolar sunspot group(2)Beta: a sunspot group having both positive and negative magnetic polarities, with a simple and distinct division between opposite polarities(3)Gamma: a complex type of AR. Unlike the Beta class, the distribution of positive and negative polarities of this type is very irregular(4)Beta-Gamma: a bipolar sunspot group with sufficiently complex distribution and no obvious boundaries between opposite polarities(5)Delta: a bipolar sunspot group with opposite polarity umbrae sharing one penumbra that spans less than 2 degrees with respect to the solar center(6)Beta-Delta: a sunspot group of Beta magnetic classification containing one or more Delta sunspots(7)Beta-Gamma-Delta: a sunspot group of Beta-Gamma magnetic classification containing one or more Delta sunspots(8)Gamma-Delta: a sunspot group of Gamma magnetic classification containing one or more Delta sunspots.

From May, 2010, to May, 2017, a total number of 11306 magnetic type classification records covering 1592 ARs are contained in the Solar Region Summary (SRS) text file, which can be downloaded from the NOAA/SWPC website https://www.swpc.noaa.gov/. As shown in Table 1, Alpha magnetic type appears 3576 times, accounting for one-third of the total records, and Beta magnetic type appears 6127 times, accounting for 54%. Complex magnetic types: Beta-Gamma, Beta-Gamma-Delta, and Beta-Delta, appear 1143, 385, and 75 times, respectively, accounting for a small portion of the total records. In addition, the Gamma, Delta, and Gamma-Delta magnetic types have not been reported in SRS files during this period, therefore they are not listed in Table 1.

Statistically, large flares are more likely to occur in ARs with complex magnetic types, while the ARs of Alpha type have a lower probability of flare eruption [5]. In this study, the sunspot magnetic type falls into three categories, the unipolar group Alpha, the bipolar group Beta, and other complex multipole groups, called Beta-x.

3. Data Preprocessing

The data used in this paper are observed by SDO/HMI [27, 28]. The 720s SHARP data (hmi.sharp_720s - Space-Weather HMI Active Region Patch) [29] are selected, which include magnetograms and continuum images with the time cadence of 12 minutes. The SHARP data provide active region maps in patches that encompass automatically tracked magnetic concentrations for their entire lifetime. All of the data files we have used are downloaded from the website http://jsoc.stanford.edu/ and are in Flexible Image Transport System (FITS) format. The data selection satisfies the following criteria:(i)The time range is from May, 2010, to May, 2017.(ii)In order to guarantee enough variations between the closest AR images, the AR data are taken every 96 minutes.(iii)The location range of the data is within the ±75 heliolongitude degrees from the solar disk center to reduce the influence of projection.(iv)Only when one SHARP number corresponds to one NOAA AR at the same time, the SHARP data is selected.(v)The selected FITS files must be of high quality. Corrupted data due to instrument failure or data of large background noise are omitted.

Based on the spatial distribution of magnetic polarities and penumbras, each AR magnetogram and continuum image is manually assigned to a corresponding magnetic type, respectively. In this labelling process, we have referred to the AR information provided by NOAA SRS files. It should be noted that a tiny amount of data have no obvious magnetic type information, which makes it difficult to label these samples manually. These data cannot be included in the analysis. The total amount of usable data is shown in Table 2. In all magnetograms, there are 6696 pictures of Alpha magnetic type, 8828 pictures of Beta, and 3646 pictures of Beta-x. In all continuum images, there are 5481 pictures of Alpha magnetic type, 7993 pictures of Beta, and 2744 pictures of Beta-x. The amount of data for each type in the data set is unevenly distributed. The smallest number of magnetic type is for Beta-x in continuum images.

The SDO/HMI magnetograms and continuum images data are read in batches, and the output is in PNG format according towhere max and min represent the maximum and minimum of the magnetic field strength, and and represent the original pixel value and processed pixel value of the same index in the data matrix, respectively. In order to maintain the uniformity of the data set, the gray value range of the magnetograms is processed. The value of max is set to be 800.0, and the min is set to be -800.0, that is, in the PNG images, the gray value of the pixel point with a magnetic field strength greater than or equal to 800 is assigned to 255, and the gray value of the pixel point with a magnetic field strength lower than or equal to -800 is assigned a value of zero. Figure 1 shows an example of AR magnetogram before and after processing. Compared to the unprocessed magnetogram, the processed magnetogram has more obvious characteristic information.

Besides, pictures obtained through the above process are interpolated into a uniform size of 160×80 to satisfy the input requirements by CNN structure.

4. Classification Model

4.1. Training Model

As a branch of artificial intelligence, machine learning algorithms allow machines to learn patterns from a large amount of historical data, thereby intelligently identifying new samples or predicting the future. The machine learning method adopted in this work is convolutional neural network (CNN), which is one of the typical algorithms of deep learning [30, 31]. CNN [3235] is a kind of feedforward neural network with convolutional computation and deep structure, but, unlike the traditional multilayer feedforward neural network, the input of CNN is a two-dimensional pattern, images for example. The connection weight of CNN is a two-dimensional weight matrix, which is also called convolution kernel. Two basic operations in CNN are two-dimensional discrete convolution and pooling. Because CNN can process two-dimensional patterns directly, it has been widely used in the field of computer vision. A schematic of the CNN structure in this work is shown in Figure 2:(i)The input data sequentially pass through three layers of convolution. The size of the convolution kernel is 5×5. The number of first-layer convolution kernels is 32, and then each layer is doubled. The convolution kernel is used to extract image features. When performing convolution, the all-zero padding is used, and the step size is set to be 1.(ii)The result of each convolution is activated by the nonlinear activation function, followed by pooling. The number of features is controlled by the pooling to avoid overfitting. When performing pooling, the all-zero padding is used, the step size is set to be 2, and kernel size is 2×2.(iii)The convolved data features are fed into a fully connected neural network. Within the fully connected neural network, there is one hidden layer containing 512 neurons, and the output layer has 3 neurons, corresponding to three different magnetic types. Among the 3 nodes, the magnetic type corresponding to the node with the highest value is the recognition result of the model.(iv)The output of the fully connected neural network passes through a softmax function to obtain the probability distribution for the output classification. The result is then compared with the data label to get the cross-entropy, so as to obtain the loss function. The softmax function and the cross-entropy formula are given by the following:where is the number of types, and is the output of the th network output unit. is the truth value of the data label, and is the output of neural networks.(vii)Optimize the model by minimizing the loss function. Each model stops training after 50,000 iterations.

4.2. Results

We have constructed three different classification models, namely, A, B, and C, respectively. Model A uses HMI magnetogram data as input, while model B uses HMI continuum image data. Model C uses both magnetogram and continuum images as two-channel input in CNN. The corresponding convolution kernel is also set to two channels in model C.

When training our models, it is required that the amount of data used for training or testing is the same for each class. At the same time, the combination of the magnetogram and continuum image in model C requires integration and matching of the two data sets. In order to satisfy these requirements, we have used the undersampling method to randomly select 2600 pictures for each class as inputs: 400 for testing and 2200 for training. Totally, there are 6600 pictures used for training and 1200 pictures for testing. The test set data do not participate in the training process.

The performance of all models is evaluated by the loss function and the accuracy rate. The loss function maps the value of a random event or its associated random variable to a nonnegative real number to represent the “risk” or “loss” of the random event. In applications, the loss function is often associated with the optimization problem as a learning criterion, which is to solve and evaluate the model by minimizing the loss function [36]. The total accuracy rate is obtained by randomly extracting some samples from the test set for magnetic type recognition after the model training is completed. These sample data are not used in the training process and can better reflect the recognition performance of the model. The recognition accuracy for each magnetic type is obtained by traversing their test set. The results are shown in Table 3. In the three models, the value of loss function for model B is the smallest, and that of model A is the largest. The total accuracy of model B is the highest, exceeding 95%, and model A has the lowest total accuracy of about 87%. Comparing the performance of the three models in each class, the accuracy of model B is the highest. Although model A and C have the same recognition accuracy for Alpha, the accuracy of model C for Beta and Beta-x are better than that of model A. Among the three categories, Alpha has the highest accuracy while Beta has the lowest accuracy. This phenomenon emerges in all three training models.

In addition, the confusion matrix is used to evaluate the classification performance of the model for the magnetic type of the AR. The confusion matrix definition is shown in Table 4. The number of samples that are correctly recognized as “Alpha” is true Alpha (TA), the number of Alpha samples that are wrongly recognized as “Beta” is false Beta_A (AB), and the number of Alpha samples that are wrongly recognized as “Beta-x” is false Beta-x_A (AC). The number of samples that are correctly recognized as “Beta” is true Beta (TB), the number of Beta samples that are wrongly recognized as “Alpha” is false Alpha_B (BA), and the number of Beta samples that are wrongly recognized as “Beta-x” is false Beta-x_B (BC). The number of samples that are correctly recognized as “Beta-x” is true Beta-x (TC), the number of Beta-x samples that are wrongly recognized as “Alpha” is false Alpha_C (CA), and the number of Beta-x samples that are wrongly recognized as “Beta” is false Beta_C (CB). The classification result of the above three models is detailed in Tables 57. It can be seen from the tables that Alpha magnetic type is misidentified as Beta magnetic type occasionally when the model recognition error occurs. Beta magnetic type is sometimes misclassified as either Alpha or Beta-x, and the error rate is more than 4%. Beta-x magnetic type is mainly misclassified as Beta. When classifying manually, the disagreement due to individual experience and personal opinion is inevitable, mainly in distinguishing Beta magnetic type and Beta-x magnetic type.

True positive rate (TP rate) and false positive rate (FP rate) are defined to measure the performance of models. The TP rate is the percentage of positive samples correctly classified, and the FP rate is the percentage of negative samples that are misclassified. The formulas for calculating TP rate and FP rate of Alpha are shown in the following:Using TP rate as the longitudinal axis and FP rate as the horizontal axis, Receiver Operating Characteristic (ROC) curves are drawn [37]. As shown in Figure 3, the point means that all samples are classified correctly. The nearer to , the higher the classification accuracy of samples. Models A, B, and C are represented by red, green, and blue, respectively. The area of the quadrilateral formed by each point and , , points is the area under the curve (AUC) of that point. The larger the AUC value, the better the classification effect of the model. It can be seen more intuitively from Figure 3 that model B has the best classification performance among the three models, and Alpha has the best classification effect among the three kinds of magnetic types.

5. Conclusion and Discussion

In order to develop the automatic identification for the AR magnetic type based on the Mount Wilson classification scheme, we adopt CNN to train the SDO/HMI magnetogram and continuum image data from 2010 to 2017. We have constructed three models: A, B, and C, using magnetograms, continuum images, and the two-channel pictures as input, respectively. The conclusions are as follows. First, CNN has a productive performance in the identification of the AR magnetic types. The overall accuracy of all three models is over 87%, and the highest total accuracy is more than 95%. The recognition accuracy for Alpha type reaches 98%, and the accuracy for Beta type maintains above 88%. Second, the best recognition performance appears when continuum image is the sole input, followed by two-channel picture as input, and the performance of training model is relatively the worst when feeding only the magnetogram data. Finally, Alpha type is the easiest to recognize while the accuracy for Beta type is the lowest in the three categories. This phenomenon exists in all three training models.

By analyzing Mount Wilson sunspot magnetic types in a large amount of continuum images, it is found that the Alpha class is generally presented in a single sunspot, Beta class generally distributes in a relatively discrete and regular sunspot group, and the majority of Beta-x class appears in a relatively large and irregularly distributed sunspot group. Although the magnetic polarity, umbra, and penumbra information of sunspot groups need to be used at the same time in Mount Wilson sunspot classification scheme theoretically, it is also feasible to use the continuum images alone to classify the three types that are defined in this work. However, it is confusing that the training performance with magnetogram or two-channel picture as input is not as good as that using continuum image only. Specific case analysis may shed a stripe of light over the black box. As shown in Figure 4, for model B, the cases that the Beta-x magnetic type is misclassified into Beta magnetic type mainly consist of two different origins: a heteropolar region can be seen in the magnetogram while there is a penumbra in the continuum image corresponding to the opposite polarity region, but no obvious multiple umbrae, as shown by the red box in Figures 4(a) and 4(b), mainly due to the inability to obtain the polarity information of the magnetic field in the continuum image; there is no obvious heteropolar region in the magnetogram while the corresponding region in the continuum image has no obvious umbra, and the distribution of sunspots is diffusing, as shown in Figures 4(c) and 4(d). The latter may belong to the early or late stage of an AR. Such a situation is highly dependent on the subjectivity of manual prelabeling. In fact, although the classification rules are clarified, it is very difficult for the classification results to be 100% unified when experts perform manual classification.

As shown in Figure 5, for model A, there are three perspectives that the Beta-x magnetic type is misclassified into Beta magnetic type. First, as shown by the red box in Figures 5(a) and 5(b), there is no noticeable heteropolar region in the magnetogram, but multiple umbrae in the same penumbra can be seen in the corresponding continuum image. Errors may occur due to the inability to accurately obtain the umbra and penumbra information of the sunspot from the magnetogram alone. Second, as shown in Figures 5(c) and 5(d), similar to the reason of model B, the magnetic type of the AR is controversial and cannot be completely counted as a model classification error. The artificial subjective consciousness accounts for a large part of the reason. Third, the AR with sufficiently complex distribution and no obvious boundary between opposite polarities contains a bipolar sunspot group with opposite polarity umbrae sharing one penumbra that spans less than 2 degrees with respect to the solar center, as shown by the red box in Figures 5(e) and 5(f). The magnetic type Beta-Gamma-Delta can be determined from the magnetogram and continuum image by referring to the above Mount Wilson sunspot classification scheme. In fact, it can be clearly seen from the magnetogram alone that the magnetic type of the AR is Beta-x, but the model classification is wrong, which may be caused by the incomplete feature extraction. This is also the main reason for the poor training performance when the model uses only the magnetogram data.

The structure of the magnetogram is more complex than that of continuum image, but the amount of data available for training is insufficient, yielding that the CNN method is not able to extract picture features well. This is possibly one of the main reasons why the training performance is not good when using only the magnetogram data or using two-channel picture as the input.

In further work, we plan to improve the recognition accuracy and try to refine the classification. Due to the different information content of magnetograms and continuum images, we will use different convolutional network structures to extract feature information for these two kinds of data separately. Then the extracted features can be integrated and fed into a fully connected neural network. Furthermore, it is necessary to continuously supplement and balance the data set.

Data Availability

The magnetograms and continuum images data used to support the findings of this study are observed by SDO/HMI; all of the FITS files we have used are downloaded from the website http://jsoc.stanford.edu/. The SRS text files can be downloaded from the NOAA/SWPC website https://www.swpc.noaa.gov/. The train set and test set data for machine learning of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.


The data used in this study are courtesy of the SDO/HMI and NOAA/SWPC science teams. This work is supported by the Beijing Municipal Science and Technology Project (Project no. Z181100002918004) and the National Defense Science and Technology Innovation Special Zone.