AUTOMATED PREDICTION OF FLARING BEHAVIOR BASED ON
COMPLEXITY MEASURES FROM SOLAR MAGNETOGRAMS
BY
AMANI M. AL-GHRAIBAH, B.S.B.M.E.
A thesis submitted to the Graduate School
in partial ful�llment of the requirements
for the degree
Master of Science
Major Subject: Electrical Engineering
New Mexico State University
Las Cruces, New Mexico
December 2012
�An Automated Predection of Flaring Behavior Based on Complexity Measures
From Solar Magnetograms,� a thesis prepared by Amani Al-Ghraibah in partial
ful�llment of the requirements for the degree, Master of Engineering, has been
approved and accepted by the following:
Linda LaceyDean of the Graduate School
Laura BoucheronChair of the Examining Committee
Date
Committee in charge:
Dr. Laura Boucheron, Chair
Dr. Phillip Deleon
Dr. James McAteer
ii
DEDICATION
I dedicate my dissertation work to my family and many friends. A special feeling of
gratitude to my loving parents, Muneer and Hanan AL-Ghraibah whose words of
encouragement and push for tenacity ring in my ears. My sister Zain, my brothers
Mohammad and Omar who all gave me an incorporeal support. A special feeling
of gratitude to my loving husband: Mohammad Omari, intelligent friend who has
never left my side. Also, I dedicate this work to my little son Karam who always
bring happiness to me after a long day of work. I also dedicate this dissertation
to my many friends who have supported me throughout the process. I will always
appreciate all they have done.
iii
ACKNOWLEDGMENTS
In the name of Allah the most merciful and most gracious, �rst and foremost all
praise and thanks to Allah (God) for giving me strength, patience, and providing
me the knowledge to �nalize this work.
I would like to thank my committee members who were more than generous
with their expertise and precious time. A special thanks to Dr. Laura Boucheron,
my adviser for her countless hours of re�ecting, reading, encouraging, and most
of all patience throughout the entire process. Thank you Dr. Phillip Deleon and
Dr. James McAteer for agreeing to serve on my committee. I would like to ac-
knowledge and thank electrical and computer engineering department for allowing
me to conduct my research. Special thanks goes to the members of astronomy
department and NMSU solar and stellar research group for their support and help
over the last two years.
Finally, I am gratefully acknowledge the New Mexico State University Interdis-
ciplinary Research Grant and NASA-EPSCOR for their funding support during
my work. Also, I would like to thank Dr. Laura Boucheron, Dr. Jason Jackiewiz
and Dr. Bernard McNamara for the great award that they gave it to me.
iv
VITA
October 9, 1985 Born in Irbid, Jordan
2003-2008 B.S.B.M.E., Jordan University of Science and Technology,Irbid, Jordan
2008-2009 Teaching Assistant, Biomedical Engineering Department,Jordan University of Science and Technology.
2010-2012 Graduate Research Assistant,Electrical and Computer Engineering Department,New Mexico State University, Las Cruces, New Mexico.
PUBLICATIONS [or Papers Presented]
1. Fields, Flares, And Forecasts. L. Boucheron, Amani Al-Ghraibah, J. McA-
teer, H. Cao, J. Jackiewicz, B. McNamara, D. Voelz, B. Calabro, K. DeGrave,
M. Kirk, A. Madadi, A. Petsov, G. Taylor. Solar Physics Division Meeting,
2011.�poster�.
2. Automated Classi�cation of Flaring Behavior in Solar Active Regions: Pre-
liminary Results. Amani Al-Ghraibah, Laura E. Boucheron and R. T. James
McAteer. American Astronomical Society 219th Meeting, 2012.�poster�.
3. Automated Predection of Flaring Behavior Based on Complexity Measures
From Solar Magnetograms. Amani Al-Ghraibah, Laura E. Boucheron and R. T.
James McAteer. Solar Information Processing Workshop, 2012.�poster�.
4. Automated Prediction of Flaring Behavior Based on Complexity Measures
from Solar Magnetograms, Amani Al-Ghraibah, Laura E. Boucheron, and R. T.
James McAteer. Solar Physics, 2012. �Submitted�
v
FIELD OF STUDY
Major Field: Digital Signal Processing and Pattern Recognition
vi
ABSTRACT
Automated Prediction of Flaring Behavior Based on Complexity Measures From
Solar Magnetograms
BY
AMANI AL-GHRAIBAH, B.S.B.M.E.
MASTER OF SCIENCE
New Mexico State University
Las Cruces, New Mexico, 2012
Dr. Laura E. Boucheron, Chair
Solar active events are the source of many energetic and geo-e�ective events
such as solar �ares and coronal mass ejections. Understanding how these complex
source regions evolve and produce these events is of fundamental importance, not
only to solar physics but also to the demands of space weather forecasting. Here,
we present work using physical properties of magnetic region complexity for an
automated classi�cation of future �are activity. First, we extract features related
to physical properties of active region magnetic �elds including fractal-, gradient-,
vii
neutral line-, emerging �ux-, and wavelet-based techniques. Second, we use au-
tomated classi�ers to predict whether an active region will �are in the following
k hours, where k will vary. Third, we apply feature selection to extract the most
signi�cant features for �are prediction and improve the classi�cation speed and ac-
curacy. This work gives a preliminary assessment of the use of feature extraction,
feature selection, and classi�cation for �are prediction as well as to lend insight
into the physical characteristics of active regions that are most discriminatory for
such a prediction task.
viii
CONTENTS
LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii
LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 The Sun and Solar Activity . . . . . . . . . . . . . . . . . . . . . 1
1.2 Relation of Photospheric Magnetic Field to Solar Activity . . . . 5
1.3 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 IMAGE ANALYSIS . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1 Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Gradient Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3 Neutral line Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.2 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4 Fractal Dimension Analysis . . . . . . . . . . . . . . . . . . . . . 23
2.4.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.4.2 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . 25
2.5 Emerging Flux Region Analysis . . . . . . . . . . . . . . . . . . . 29
ix
2.5.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.5.2 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . 30
2.6 Wavelet Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.6.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.6.2 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . 34
3 CLASSIFICATION, FEATURE SELECTION AND PERFORMANCE
MEASURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.1 Fisher Linear Discriminant Analysis (FLDA) . . . . . . . . . . . . 39
3.2 Relevance Vector Machine (RVM) . . . . . . . . . . . . . . . . . . 40
3.3 Feature Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.4 Performance Measures . . . . . . . . . . . . . . . . . . . . . . . . 46
4 EXPERIMENTS AND RESULTS . . . . . . . . . . . . . . . . . . 49
4.1 Experiment setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2 Classi�cation using Fisher Linear Discriminant Analysis . . . . . . 51
4.2.1 Classi�cation Using All Features . . . . . . . . . . . . . . . 51
4.2.2 Classi�cation Using Feature Subsets . . . . . . . . . . . . . 52
4.3 Classi�cation using Relevance Vector Machine . . . . . . . . . . . 57
4.3.1 Classi�cation Using All Features . . . . . . . . . . . . . . . 57
4.3.2 Classi�cation Using Feature Subsets . . . . . . . . . . . . . 58
4.4 Classi�cation after Feature Selection . . . . . . . . . . . . . . . . 62
4.4.1 FLDA Classi�cation on Optimal Subset . . . . . . . . . . 63
x
4.4.2 RVM Classi�cation on Optimal Subset . . . . . . . . . . . 65
4.4.3 Determination of an Appropriate Number of Optimal Features 66
5 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6 FUTURE WORK . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
APPENDICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
A MATLAB CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
A.1 Gradient Analysis Code . . . . . . . . . . . . . . . . . . . . . . . 77
A.2 Neutral line Detection Code . . . . . . . . . . . . . . . . . . . . . 79
A.3 Fractal Dimension Code . . . . . . . . . . . . . . . . . . . . . . . 83
A.4 Emerging Flux Region Code . . . . . . . . . . . . . . . . . . . . . 86
A.5 Wavelet Analysis Code . . . . . . . . . . . . . . . . . . . . . . . . 89
A.6 Feature Selection Code . . . . . . . . . . . . . . . . . . . . . . . . 91
A.7 Fisher Linear Discriminant Analysis Classi�cation Code . . . . . . 94
A.8 Relevance Vector Machine (RVM) Classi�cation Code . . . . . . . 99
REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
xi
LIST OF TABLES
1 Features extracted from gradient analysis. . . . . . . . . . . . . . 13
2 Features extracted from neutral line analysis . . . . . . . . . . . . 22
3 Features extracted after EFR analysis . . . . . . . . . . . . . . . . 32
4 Features extracted from wavelet analysis. . . . . . . . . . . . . . . 37
5 Flaring forcasting contingency table . . . . . . . . . . . . . . . . . 47
6 The top 16 ranked features at 14 hours timescale. . . . . . . . . . 64
xii
LIST OF FIGURES
1 Magnetogram image. . . . . . . . . . . . . . . . . . . . . . . . . . 9
2 Magnetogram active region image and the resultant magnitude gra-
dient image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Standard deviation feature and active region's �are times. . . . . 14
4 Noisy zero-Gauss contour before being weighted by the gradient
image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5 Visualizations of the gradient-weighted NL for a simple bipolar re-
gion and a multipolar region . . . . . . . . . . . . . . . . . . . . . 18
6 Thresholded GWNL images for the bipolar and multipolar ARs
considered in Figure 5. . . . . . . . . . . . . . . . . . . . . . . . . 20
7 Values of gradient-weighted length of the NL and the active region's
�are times. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8 Examples of dilated neutral line image with two di�erent structur-
ing element radii. . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9 Example log-log plot of dilated area versus structuring element ra-
dius (points) along with the least-squares �tted line. . . . . . . . . 27
10 Three example NL images and their respective NL FD. . . . . . . 27
xiii
11 Fractal dimension values and the active region's �are times for one
active region. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
12 Two magnetogram images taken on 10/29/2003 and their resultant
di�erence image. . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
13 Thresholded di�erence image and its binary mask. . . . . . . . . . 32
14 Maximum values of the di�erence images in one active region and
known �are times. . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
15 The original magnetogram image and its three highpass detail im-
ages after one level of wavelet decomposition. . . . . . . . . . . . 36
16 Energy values at 5 levels of wavelet decomposition for the image
shown in Figure 15(a). . . . . . . . . . . . . . . . . . . . . . . . . 37
17 Energy values at level 2 for one active region and known �are times. 38
18 Illustration of FLDA classi�cation for a two class case. . . . . . . 41
19 Illustration of RVM classi�cation for a two class case. . . . . . . . 43
20 FLDA classi�cation results using a combination of all features. . . 51
21 FLDA classi�cation results using gradient features listed in Table 1. 54
22 FLDA classi�cation results using neutral line features listed in Ta-
ble 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
23 FLDA classi�cation results using the fractal dimension feature. . . 55
24 FLDA classi�cation results using emerging �ux region features listed
in Table 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
xiv
25 FLDA classi�cation results using wavelet features listed in Table 4. 56
26 RVM classi�cation results using a combination of all features. . . 57
27 RVM classi�cation results using gradient features listed in Table 1. 59
28 RVM classi�cation results using neutral line features listed in Table 2. 60
29 RVM classi�cation results using fractal dimension feature. . . . . 60
30 RVM classi�cation results using emerging �ux region features listed
in Table 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
31 RVM classi�cation results using wavelet features listed in Table 4. 61
32 Histogram of features selected at 14 hours timescale ranked from
least frequent at 1 to most frequent at 35. . . . . . . . . . . . . . 63
33 FLDA classi�cation results using 6 top-ranked features. . . . . . . 65
34 RVM classi�cation results using 6 top-ranked features. . . . . . . 66
35 RVM classi�cation results using 10 top-ranked features. . . . . . . 67
36 RVM classi�cation results using 3 top-ranked features. . . . . . . 68
37 TSS values at 14 hour before �are case using di�erent features subsets. 69
xv
1 INTRODUCTION
1.1 The Sun and Solar Activity
The sun is the closest star to the earth. It is the source of heat which sustains
life to earth and controls our climate and weather. The sun is an intensely hot,
self-luminous body of gases at the center of the solar system. Its gravitational
attraction maintains the planets, comets, and other bodies of the solar system in
their orbits.
The sun has many di�erent layers that describe its structure, including the
core, radiation zone, convection zone, photosphere, chromosphere, and corona.
The core is the innermost layer of the sun and it is a source for all the sun's energy.
Once the energy is produced in the core of the sun, it has to travel from the solar
center to the outer regions. From that the radiation zone provides an e�cient
means of transferring energy near the core and the temperature in the radiation
zone is cooler than the core. In the convective zone, the energy is transferred much
faster than it is in the radiative zone. This is because it is transferred through
the process of convection. Hotter gas coming from the radiative zone expands and
rises through the convective zone. It can do this because the convective zone is
cooler than the radiative zone and therefore less dense. As the gas rises, it cools
1
and begins to sink again. As it falls down to the top of the radiative zone, it heats
up and starts to rise. This process repeats, creating convection currents and the
visual e�ect of boiling on the Sun's surface which is called granulation [47].
As we look down into the atmosphere at the surface of the Sun the view
becomes more and more opaque. The point where it appears to become completely
opaque is called the photosphere. Thus, the photosphere may be thought of
as the imaginary surface from which the solar light that we see appears to be
emitted. The diameter quoted for the Sun usually refers to the diameter of the
photosphere. The Photosphere emits most of the Sun's light that reaches earth
directly. Temperatures range from about 18,000 F (10,000 C) at the bottom
to 8,000 F (4,000 C) at the top; its density is about 1/1,000 that of air at the
surface of Earth. The Photosphere has a granular structure and sunspots are
photospheric phenomena. The layer that sits just above the photosphere is called
the chromosphere and it is the extended gases from photosphere. Opposite of the
photosphere, the temperature of this layer increases with increasing height, its
temperature at the top of photosphere is only about 4,400 K, while at the top of
the chromosphere, some 2,000 km higher, it reaches 25,000 K. One of the features
of the chromosphere is the chromospheric network. It outlines the supergranules
and is present there because of the magnetic �eld bunches in the supergranules.
The network makes a web pattern of magnetic �eld lines on the Sun.
The outermost layer of the sun is the corona. Visible for the human eyes only
2
during eclipses, it is a low density cloud of plasma with higher transparency than
the inner layers. The corona is hotter than some of the inner layers. Its average
temperature is 1 million K (2 million F) but in some places it can reach 3 million
K (5 million F) [47].
The sun is not a quiet star, but one that exhibits sudden releases of energy.
Solar activity refers to any natural phenomena occurring on or in the sun, such as:
sunspots and the solar cycle, solar �ares, solar wind, and coronal mass ejections.
Sunspots are dark, planet-sized regions that appear on the surface of the sun. The
average number of spots that can be seen on the face of the sun is not always the
same, but goes up and down in a cycle called the sunspot cycle, which has an
average period of about eleven years. Sunspots are caused by the sun's magnetic
�eld welling up to the photosphere. The powerful magnetic �elds around sunspots
produce active regions on the sun, which often lead to solar �ares and Coronal
Mass Ejections (CMEs). The solar activity of �ares and CMEs are called �solar
storms�.
Solar �ares are among the most energetic events in the solar system and have
intrigued generations of physicists. These events in�uence a panorama of physical
systems, from the surface of the Sun, through the solar system and onto Earth,
where they can cause adverse space weather conditions. Flares occur in active
regions in outer solar atmosphere (corona). Active regions (ARs) are volumes of
the Sun with complex, twisted magnetic �eld con�gurations. The energy released
3
by solar �ares (up to ≈ 1032 erg) is thought to come from the energy stored in the
magnetic �eld being suddenly converted into other forms, accelerating particles
to near-relativistic speeds and creating temperatures in excess of 10,000,000 K.
Turbulent motions on the surface of the Sun (the photosphere) twist and wind up
the magnetic �eld in the corona. A complex photosphere causes a complex corona,
and a complex corona has more stored energy, hence will produce more, larger,
solar �ares. However, the precise conditions required to create these enormously
energetic events are as yet unknown and so accurate space weather forecasts re-
main elusive.
At the surface of the Earth we are well protected from the e�ects of solar �ares
and other solar activity by the Earth's magnetic �eld and atmosphere. The most
dangerous emissions from �ares are energetic charged particles (primarily high-
energy protons) and electromagnetic radiation (primarily x-rays). Coronal mass
ejections are more likely to have a signi�cant e�ect on our activities than �ares
because they carry more material into a larger volume of interplanetary space.
While a �are alone produces high-energy particles near the Sun, some of which
escape into interplanetary space, a CME drives a shock wave which can contin-
uously produce energetic particles as it propagates through interplanetary space.
When a CME reaches the Earth, its impact disturbs the Earth's magnetosphere,
setting o� a geomagnetic storm. A CME typically takes 3 to 5 days to reach
the Earth after it leaves the Sun. Observing the ejection of CMEs from the Sun
4
provides an early warning of geomagnetic storms.
1.2 Relation of Photospheric Magnetic Field to Solar Activity
Many studies have been made of coronal activity and their concomitant photo-
spheric �eld distributions [1�3,8, 9, 13�16,20,24�26,28,29, 32,37�39,43�45,55,59,
65,69�72,74]. A consistent, causal relationship between photospheric �eld condi-
tions and activity is unknown (e.g., see conclusions in [25,37,39,43]). Nevertheless,
there is optimism that photospheric measures may yield some insight into immi-
nent eruptive behavior (e.g., [1, 2, 13,20,24,32,38,55,69]).
Many of the previously mentioned studies rely on measures from vector mag-
netograms [15, 16, 25, 37�39, 74], which provide both longitudinal (line-of-site)
and transverse components, but is not yet readily available for large datasets.
This thesis will look at a large set of parameters, unlike the few (≤ 7) studied
in [1�3,8,9,13�16,20,24�26,28,29,32,43�45,55,59,65,69�72,74]. Furthermore, we
study a large data sample unlike [1�3,8,14�16,24�26,32,37,38,65,74] who utilize
< 100 active regions, and we explicitly include control data (i.e., regions that do
not �are) unlike [1�3, 24�26, 45, 55, 65, 74]. Our work will also utilize standard
pattern recognition and classi�cation techniques to determine (classify) whether
a region is expected to �are; this is in contrast to many previous studies that
rely merely on correlations or observations of parameters in relation to �aring
activity [1�3,8, 9, 24�26,29,32,37,44,45,55,65,74].
5
To the best of our knowledge, there are no studies that use both line-of-sight
magnetograms and a large dataset. In this thesis, we will analyze a large set of line-
of-sight (LOS) Michelson Doppler Imager (MDI) magnetograms [58] and extract
a large set of features to describe active region complexity and other features
of postulated importance for �are prediction. We hope this work will provide
a similar reference for LOS magnetograms as the comprehensive work on vector
magnetograms [39]. Of particular interest in this work is the characterization of
local structure of active region �elds�critical in many theories of activity�that can
be lost in some global measures. The general categories of features we consider
are:
1. Field gradient, indicative of pressure build-up in the photosphere
2. Neutral lines, related to energy release locations
3. Fractal dimension, which relates to the active region complexity
4. Emerging �ux regions, which can act as energy release triggers
5. Wavelet analysis, which allows separation of the �eld into its component
lengthscales
These measurements will allow us to more completely characterize �eld distri-
butions in active regions. Furthermore, we will consider these features in an
automated classi�cation framework whereby we will predict a �are occurrence for
6
a given time window using a combination of the features. Additionally, we use
feature selection to determine the optimal features for describing the complexity
of an active region. This will allow for an improvement in both the computational
e�ciency and accuracy of the classi�cation algorithms.
1.3 Outline
We present details of the complexity features we use in Chapter 2, including a
physical motivation for each of the features and the speci�cs of extracting those
features. We brie�y review the automated classi�cation methods in Chapter 3, and
present results using the proposed features for classi�cation of �are activity and
discuss discriminatory features in Chapter 4. In Chapter 5 we provide discussion
and conclusions, and future work in Chapter 6.
7
2 IMAGE ANALYSIS
In this chapter we describe the dataset used for this work and provide background
and technical description related to each of the �ve main categories used for feature
extraction.
2.1 Dataset
Magnetogram images are not a �picture� of the Sun which you might see with your
eyes. Rather, it's an image taken by an instrument which can detect the strength
and location of the magnetic �elds on the sun. In a magnetogram image, grey
areas indicate that there is low magnetic �eld, while black and white areas indicate
regions where there is a strong positive (white) or negative (black) magnetic �eld
[33]. Figure 1 shows an example of one magnetogram image; its size is 152x152
pixels and is not a �xed size for all of the magnetogram images. Our dataset
contains approximately 2000 di�erent active regions (ARs), where each active
region is saved in one directory. Each of these directories has tens to hundreds of
subsequent magnetogram images showing the development of that active region
on the solar surface.
For our work, magnetogram images are considered only if the center of the AR
is within 650 arcseconds of the disk center (the full disk radius is 950 arcseconds)
to avoid projection e�ects and disk edge artifacts. To do that, the distance from
8
Figure 1: Magnetogram image.
the disk center to the center of the active region is calculated and it is called
the radius. Then, we ignore the image if the resulting radius is greater than 650
arcseconds. This condition is applied to each magnetogram image in our data
before the feature extraction process is started.
2.2 Gradient Analysis
2.2.1 Background
The evolution of magnetic �elds in solar active regions can be described by the
magnetic induction equation
∂B
∂t= ∇× (v ×B) +
1
Rm
∇2B (1)
where Rm is the magnetic Reynolds number, and v and B are the vector velocity
and magnetic �elds, respectively. The magnetic Reynolds number varies from 106
to 1010 in the photosphere (e.g., [48]), meaning that the �rst term on the right hand
9
side of Equation (1) dominates on the solar surface. That is, the magnetic �eld is
frozen into the plasma, and is advected by bulk plasma motions. It is because the
�eld is frozen into the plasma in the photosphere that large transverse gradients
are observed across the neutral line (the line separating positive and negative
polarities) of large δ spots [49] [74]. Here, converging photospheric �ows sweep
opposite polarity �elds towards the neutral line of the δ. Over a period of hours,
the continued concentration of opposite polarities in a relatively small area leads
to strong transverse gradients [19].
In general, the spatial gradient provides a measurement of �eld conditions at
localized positions within the region. Photospheric �eld gradients have long been
reported to be associated with �aring activity and have been reported by many
authors for individual single events (e.g., [74]). From a theoretical perspective,
several models predict the existence of increased gradients in the �eld for a few
hours prior to activity [4] [51].
Other researchers have used gradient analysis for �are prediction. Wang et
al [65] concentrated his study on the analysis of the magnetic gradient along �aring
neutral lines where he found that the onset of each solar �are is followed by an
obvious change in the magnetic gradient. Zhang [73] de�ned the nonpotentiality
of solar active regions depending on the shear and gradient of the magnetic �eld
because they are important and re�ect the strength of the electric current in the
active regions. The magnetic gradient was used by Prasad [50] to di�erentiate the
10
stressed magnetic �elds in active regions. Leka and Barnes ( [37], [38], [39]) used
the �rst four moments of the spatial gradient magnitude in their discriminatory
analysis for �aring and non-�aring regions. Yu et al [69] used the maximum
horizontal gradient as one of three parameters in their multiresolution short-term
solar �are prediction.
2.2.2 Data Processing
From the perspective of image processing, the spatial gradient is the �rst derivative
of the image. This processing will highlight small specks and edges that may not
be as visible in the original image. For an image f(x, y), the gradient of f at
coordinates (x, y) is de�ned as the two-dimensional column vector [21]
vf =
[Gx
Gy
]=
[df/dxdf/dy
]= (
df
dx)i+ (
df
dy)j (2)
where Gx and Gy are the spatial gradients in the x and y directions, respectively,
and i and j are unit vectors in the x and y directions, respectively. The magnitude
of this vector is given by:
|vf | =√G2x +G2
y (3)
To approximate the �rst derivative for the discretely-indexed image f , we use
the two Sobel �lters
hx =
−1 0 1−2 0 2−1 0 1
(4)
11
(a) Original magnetogram image. (b) Magnitude gradient image.
Figure 2: Magnetogram active region image and the resultant magnitude gradient
image. In the later image, we note that the high gradient regions (red colors)
correspond to regions where the polarity at the magnetic �eld changes over a
small spatial scale.
and
hy =
1 2 10 0 0−1 −2 −1
(5)
The image is �ltered (convolved) with each Sobel �lter, yielding Gx = hx ∗ f and
Gy = hy ∗ f where ∗ is the 2-dimensional convolution operator.
Figure 2 shows an example of one magnetogram image and the magnitude
gradient result of that image. From Figure 2 (b) we can note that regions with
the largest gradient (red colors) correspond to regions where the polarity of the
magnetic �elds changes over a small spatial scale.
The gradient magnitude is computed for each magnetogram image in our
dataset. To condense this gradient information into single descriptors for each
12
Table 1: Features extracted from gradient analysis.
Gradient Features
Standard deviation Mean
Minimum Maximum
Median Skewness
kurtosis
image, we compute the mean, standard deviation, maximum, minimum, median,
skewness, and kurtosis for each image. In total, 7 features are extracted for the
gradient analysis as summarized in Table 1.
To see a qualitative relation between these features and the active region's
�are times, feature values were plotted with respect to time (number of images in
one active region). Figure 3 shows an example of a plot of the standard deviation
feature for one active region which includes 120 magnetogram images. Each black
point in the �gure is a known time for a �are in this active region and the blue
curve are values of the standard deviation of each gradient image; we can conclude
that the standard deviation could be a good indication of solar �ares as the curve
goes up just prior to active region �aring.
13
Figure 3: Standard deviation feature values (blue line) and the active region's
�are times (black points). We can conclude that the standard deviation could be
a good indication of solar �are as the curve goes up just prior to active region
�aring.
14
2.3 Neutral line Analysis
2.3.1 Background
The neutral line (NL) is de�ned as the line separating opposite polarities. Parker [48]
and Roumeliotis et al [54] recently showed that energy can be stored in the corona
when sunspots of opposite polarity are pushed together, thereby forming an ex-
tended current sheet above the NL. This current sheet steadily lengthens until
it is disrupted by an instability, which results in a large-scale release of energy.
The connection between NLs, current sheets, and reconnection was �rst recog-
nized by Dungey [12], who showed that magnetic �elds with an X-type �are class
topology tend to form above NLs, which can then result in spontaneous current
sheet formation. More recently, the tether-cutting model described in [46] and
the break-out model of [4] have shown that gradual shearing motion both across
and along the NL, can result in the formation of unstable arcade structures in the
solar corona, which can then erupt. It is clear that the behavior of the magnetic
�eld in the proximity of the NL, and the morphology and evolution of the NL
itself, are essential to understanding and predicting solar �ares and CMEs.
Recently, from a sample of 5 active regions that produced great �ares, Wang [65]
reported that great �ares occurred speci�cally in the NLs with maximum gradi-
ent. Mason et al [43] and Yu et al [69] both use the primary inversion line length
as one of four parameters in a study of automated �are forecasting, while Jing et
15
al [32] use the length of the strong-gradient NL to study the relationship with �are
productivity. Falconer et al [13] use the weighted length of the strong-gradient
NL to forecast major �ares, and other eruptive solar events.
2.3.2 Data Processing
First, the magnetogram images are smoothed using a 10x10 pixel averaging �lter
to remove much of the statistical noise which would otherwise limit the e�ec-
tiveness of subsequent steps. Second, contours at the zero Gauss level of the
smoothed image are overlaid on the original magnetogram image. Pixels along
this zero-Gauss contour are used to create a neutral line (NL) mask where the pix-
els along the NL are set to a value of 1 and other pixels are set to 0. Third, since
the zero-Gauss contours will �ag all pixels at the zero-Gauss level, including those
with very small gradient (i.e., not at the NL of the AR), we mask the gradient
image as described in Section 2.2 with the NL mask. This highlights regions of
the NL for which there is a large spatial gradient, indicating a transition between
large positive and large negative �ux. Figure 4 illustrates all of the zero-Gauss
contours for both a bipolar and multipolar region, while Figure 5 show two dif-
ferent visualizations of this gradient-weighted neutral line (GWNL) for the same
bipolar and multipolar ARs.
16
(a) Bipolar region. (b) Multipolar region.
Figure 4: Noisy zero-Gauss contour before being weighted by the gradient image.
Note the presence of many small zero-Gauss contours even in the quiet sun.
17
(a) Magnetogram image overlaid with NL
for a simple bipolar region.
(b) Gradient-weighted NL visualized as a
scaled image for a simple bipolar region.
(c) Magnetogram image overlaid with NL
for a multipolar region.
(d) Gradient-weighted NL visualized as a
scaled image for a multipolar region.
Figure 5: Visualizations of the gradient-weighted NL for a simple bipolar region
in (a) and (b) and a multipolar region in (c) and (d). In the visualization of (a)
and (c), the magnetogram image is overlaid with the NL. Larger yellow markers
indicate the presence of a stronger gradient at that spatial location along the
NL. The visualization of (b) and (d) shows the gradient-weighted NL as a scaled
image, where black colors indicate a higher gradient. These regions correspond to
the same regions illustrated in Figure 4.
.18
Falconer et al [16] distinguishes between purely bipolar active regions with a
single main neutral line and a complex active region with a mix of opposite-polarity
magnetic �ux resulting in no unambiguous main neutral line, called multipolar
active regions. In this work, we make no distinction between the primary NL and
the NL as it exists separating the mixed opposite polarity regions.
The NL is detected for each image in our dataset. We de�ne a total of 13
features related to the neutral lines. The �rst three features are de�ned as follows:
• Length of the NL: The GWNL is thresholded at 20% of the maximum value
to yield a strong-gradient binary NL mask. The length of this NL is deter-
mined as the sum of the pixels.
• Number of fragments of the NL: Using the same thresholded GWNL, the
number of fragments is de�ned as the number of 8-connected components
in the binary NL mask image.
• GWNL length: The gradient-weighted length of the NL, computed by sum-
ming the pixels in the GWNL image.
As illustration, Figure 6 shows the thresholded GWNL for each of the active
regions shown in Figure 5.
Additionally, ten more features are extracted based on the NL boundary cur-
vature and NL bending energy. For the extraction of these features, we compute
the orientation angle of each NL pixel in the thresholded image by considering
19
(a) Thresholded bipolar NL. (b) Thresholded multipolar NL.
Figure 6: Thresholded GWNL images for the bipolar and multipolar ARs consid-
ered in Figure 5.
the inverse tangent of the slope between the current pixel and adjacent pixel [53]:
θn = arctan
(y(n+ 1)− y(n)
x(n+ 1)− x(n)
), n = 1, . . . , N (6)
where x and y are the x- and y-coordinates of the N NL pixels, and by de�nition
x(N + 1) = x(1) and y(N + 1) = y(1). The curvature angles are computed
separately for each NL segment, and the mean, standard deviation, maximum,
minimum, and median is computed for the distribution of all curvature angles for
all NL segments.
The bending energy is analogous to the physical energy required to bend a
rod and is computed as the sum of the di�erence between subsequent boundary
points [53]:N∑n=1
(θn+1 − θn) (7)
This measure is computed separately for each NL segmented and the mean, stan-
20
Figure 7: Values of gradient-weighted length of the NL (blue line) and the active
region's �are times (black points). We can conclude that this feature could be a
good indication of solar �are as the curve goes up during and just prior to active
region �aring
dard deviation, maximum, minimum, and median is computed for the distribution
of bending energy. Table 2 summarizes the 13 features extracted from the neutral
line analysis. Figure 7 is an example of one of the features extracted in this section
which is the gradient-weighted length of the NL with the �are times in one active
region. Each black point in the �gure is a known time for a �are in this active
region and the blue curve are values of the gradient-weighted length of the NL of
each NL image; we can conclude that this feature could be a good indication of
solar �are as the curve goes up during and just prior to active region �aring.
21
Table 2: Features extracted from neutral line analysis
Neutral Line Features
NL length Number of NL fragments
NL Gradient NL Curvature Minimum
NL Curvature Std NL Curvature Maximum
NL Curvature Mean NL Curvature Median
NL Bending Energy Std NL Bending Energy Mean
NL Bending Energy Min NL Bending Energy Max
NL Bending Energy Median
22
2.4 Fractal Dimension Analysis
2.4.1 Background
In the absence of di�usion, and assuming that surface magnetic �elds are largely
vertical [60] and that �ows are largely horizontal, Tao et al [62] showed that the
advection of magnetic �ux tubes by random motions results in a spatial distribu-
tion of �ux which is clearly fractal. The complex nature of the surface magnetic
�elds has been studied by Lawrence and co-workers [34] [36] [7] [35], who �nd that
line-of-sight �elds scale in a self-similar and fractal manner. Prompted by these
and other �ndings,Schrijver et al [56] were able to demonstrate that the geom-
etry of �ux concentrations on the solar surface is well described by percolation
theory [57] [67], which naturally results in fractal dimensions consistent with ob-
servational values. Most recently,Vlahos et al [64] describe a 2D percolation model
for the formation and evolution of active regions, in which �ux tubes emerge from
the convective zone, and are subject to random surface motions. The magnetic
patterns formed on the solar surface form well-de�ned fractals which can evolve
towards a Self-Organized-Criticality (SOC). Further, the distribution of energies
in these models is consistent with those observed on the Sun.
Fractal dimension, D, is one of the important characteristics of fractals. D
is a statistical quantity indicating the complexity of the fractal in the sense of
its space �lling characteristics as one looks at �ner and �ner scales [41]. D can
23
also be used to measure the degree of boundary fragmentation or irregularity over
multiple scales [42].
There are many de�nitions of fractal dimensions that can be invoked to mea-
sure the fractal dimension D of a signal including the Hausdor� Dimension (DH),
Minkowski-Bouligand dimension (DM), box counting dimension (DB), and en-
tropy dimension (DE).
The commonly-used box counting method measures the fractal dimension by
partitioning the plane with a grid of squares of side ε and counting the number
N(ε) of squares that intersect the signal. The box counting dimesion DB is de�ned
as [42]:
DB = limε→0
log ε2N(ε)
log(ε)(8)
where ε2N(ε) is the box cover area. For the Minkowski-Bouligand dimension, a
curve is dilated using disks of di�erent radii ε and the union of these disks centered
at all points of the curveX creates a `Minkowski cover.' The Minkowski-Bouligand
dimension DM is de�ned by:
DM = limε→0
(2− logA(ε)
log(ε)) (9)
where A is the area of the dilated set at each scale ε and ε is the radius of the
structuring element used in the dilation step [42].
Based on the work of Maragos et al [42], in which it is concluded that DM is
closely related to DH (which is how Mandelbrot de�ned fractal dimension) and
24
able to quantify the fractal aspects of a signal while being simpler to compute, we
use the Minkowski-Bouligand dimension DM in subsequent work.
2.4.2 Data Processing
We begin with creation of the structuring element used in the morphological
operations. Generally, the structuring element is a matrix consisting of 0's and 1's
that can have any arbitrary shape and size. In this work, the disk shape (circle)
is used as a structuring element with radius ε chosen to be in the interval [1,10]
pixels.
This variable sized structuring element is used to dilate the binary NL image
(as described in Section 2.3). Dilation is a morphological operation that grows
or thickens objects in a binary image [22]. In essence, the value of the output
pixel (the pixel for which the structuring element is centered) is the maximum
value of all the pixels in the structuring element's neighborhood [22]. Dilation is
repeated with ten structuring elements of increasing radii to yield ten di�erent
dilated images. Figure 8 shows an example of one neutral line binary image after
dilation with a structuring element of radius r = 3 and r = 4.
Next, the area of each dilated image is determined by counting the number
of pixels with a value of 1. The relationship between these areas and the radius
of the structuring elements is shown in Figure 9, plotted in log-log per Equation
(9). From Equation (9), we can conclude that the fractal dimension is equal to 2
25
(a) Dilated image with radius r = 3 (b) Dilated image with radius r = 4
Figure 8: Examples of dilated neutral line image with two di�erent structuring
element radii.
minus the slope of the line �tted for the log-log plot shown in Figure 9.
Three examples of simple, complex, and no neutral line images are shown in
Figure 10 along with the resultant fractal dimension (FD). We note that the image
with no neutral line has the least FD value, while the complex neutral line has
the highest FD value. It thus appears that the FD of the NL varies with the
complexity of the NL and may be an important feature to distinguish regions
with complex magnetic con�gurations. Figure 11 shows the FD values for one
active region and the related �are times shown as black points. From that �gure
the FD values are becoming larger prior to a �are, so we can expect a �are at a
time when FD value is high.
26
Figure 9: Example log-log plot of dilated area versus structuring element radius
(points) along with the least-squares �tted line.
(a) Image with no NL, FD = 1.05 (b) Simple NL, FD = 1.49
(c) Complex NL, FD = 1.604
Figure 10: Three example NL images and their respective NL FD.
27
Figure 11: Fractal dimension values (blue line) and active region's �are times
(black points) for one active region. Note that FD values are becoming larger
prior to a �are, so we can expect a �are at a time when FD value is high.
28
2.5 Emerging Flux Region Analysis
2.5.1 Background
Magnetic �ux emergence is the origin of sunspots and active regions, and is of-
ten associated with solar activities like solar �ares and coronal mass ejections
(CMEs) [30]. In the initial phase of �ux emergence, the two opposite magnetic
polarities move apart at a relatively large speed (∼ 5 km/s) and then slow. New
�ux emerges continuously in the central part between the main polarities. The
newly emerged magnetic polarities separate and reach the already emerged main
polarities with high velocities.
Feynman et al [17] found that �lament eruptions are usually triggered by
Emerging Flux Regions (EFRs), while Tang et al [61] found that major �ares
tend to be associated with new �ux emergence. From a theoretical perspective,
the emerging �ux model of Heyvaerts et al [27] was among the �rst to address this
problem. In their model, a �are develops in three phases: (a) The pre�are heating
phase during which the emerging �ux reconnects with the overlying �eld. (b) The
impulsive phase is initiated by the onset of turbulence in the current sheet, which
accelerated particles to form microwave burst. (c) The main phase is characterized
by rapid annihilation of magnetic �eld in the current sheet. Moreover, CMEs,
which may be associated with �lament eruptions and/or �ares, could also be
triggered by EFRs as reported by Green et al [23]. EFRs can have immediate
29
e�ect on the stability of active regions and �laments and understanding EFRs is
very important to study and predict solar activities and space weather [30].
2.5.2 Data Processing
Every two subsequent images (in one active region) are subtracted to yield a
di�erence image. EFRs are identi�ed as areas in the di�erence image showing
large deviations (> 3σ) above the mean di�erence level. Figure 12 shows two
subsequent images and the di�erence between them while Figure 13 (a) shows the
masked 3σ regions (while all others have been set to zero) and Figure 13 (b) shows
a binary mask of the 3σ regions.
It should be noted that subsequent images may di�er in size by one pixel in each
dimension. To alleviate problems computing di�erence images for di�erently sized
images, a �xed image size is selected to be the new size for all the magnetogram
images, so some of them are interpolated and some are downsampled. Then nine
features are extracted as follows and as summarized in Table 3:
• EFR sum: the sum of the di�erence image (the EFR image).
• EFR absolute sum: the sum of the absolute value of the di�erence image.
• EFR gradient: the sum of the gradient image masked by the binary 3σ
image.
• EFR area 3 sigma: area of the 3σ region.
30
(a) Magnetogram image taken at 12:51. (b) Magnetogram image taken at 14:27.
(c) Di�erence image.
Figure 12: Two magnetogram images taken on 10/29/2003 and their resultant
di�erence image.
• EFR mean, EFR standard deviation, EFR median, EFR minimum, and
EFR maximum features: statistics of the EFR image.
Figure 14 shows an example of one of the statistical features plotted versus
time for one active region. We notice that some of the �ares (the black points on
the curve) take place when the maximum value of the di�erence image at that
time is large. This result may give a hint about the importance of the statistical
31
(a) Masked image by 3σ. (b) Binary image showing the 3σ region.
Figure 13: Thresholded di�erence image and its binary mask.
Table 3: Features extracted after EFR analysis
EFR Features
EFR Sum EFR Absolute sum
EFR Gradient EFR Area 3 sigma
EFR Std EFR Mean
EFR Minimum EFR Maximum
EFR Median
features (for example the maximum value of the di�erence image) as it has a
relation increasing or decreasing with the time of �aring.
32
Figure 14: Maximum values of the di�erence images in one active region and
known �are times in black dots. We notice that some of the �ares take place
when the maximum value of the di�erence image at that time is large.
33
2.6 Wavelet Analysis
2.6.1 Background
A wavelet analysis will provide an indispensable complement to the fractal analysis
discussed in Section 2.4. Measuring the fractal dimension of an active region
magnetic �eld is an essentially global investigation of the scaling properties of the
magnetic �eld. A wavelet analysis of magnetograms can discriminate spatially
localized scale features such as the emergence/submergence of �ux tubes. The
wavelet transform which maps scale content - the power in a particular location -
will be essential for determining the relative in�uence of local magnetic features
against the global properties of the active region �eld. Local magnetic features are
fundamental to many �are theories and so such a study forms a complementary
counterpart to a fractal analysis in developing our understanding of active region
physics.
2.6.2 Data Processing
If an image has both large and small objects which are present simultaneously
then it can be advantageous to study them at several resolutions. A simple struc-
ture for representing images at more than one resolution is the �image pyramid�.
An image pyramid is a collection of decreasing resolution images arranged in the
shape of a pyramid. Related to the concept of an image pyramid is the wavelet
34
transform. The wavelet transform utilizes basis function with compact time (spa-
tial) support (i.e., �nite in time/space). This is in contrast to the commonly used
Fourier transform whose basis functions, complex exponentials, are not compact
in time (space). Thus, the wavelet transform allows for both time (space) and
frequency resolution, although there is a tradeo� between the resolutions achiev-
able simultaneously. A variety of di�erent basis functions can be de�ned, each of
which has di�erent properties in time (space) and frequency. In this work, we use
the Haar wavelet [22] and a �ve-level decomposition.
Using the Haar transform, we can determine the resultant �lter coe�cients,
yielding a low resolution image (lowpass image) and three highpass detail images
(horizontal, vertical, and diagonal details) for each level of decomposition. Sub-
sequent levels of decomposition begin with the lowpass image from the previous
level.
Figure 15 shows an original magnetogram image and its three highpass details
images where each is half the original image size. These three highpass detail im-
ages are used to determine the energies of each level of decomposition by summing
the absolute values of the wavelet coe�cients (the highpass images). Five energy
values (features) are extracted for each image in the active region. Figure 16 shows
the resultant energy values at each level for the same image as shown in Figure 15
where the energy values are normalized for image area. Table 4 summarizes the
wavelet features. To get a qualitative relation between energy values and �aring
35
(a) Original magnetogram image. (b) Horizontal detail image.
(c) Vertical detail image. (d) Diagonal detail image.
Figure 15: The original magnetogram image and its three highpass detail images
after one level of wavelet decomposition.
at one active region, we include Figure 17 which shows the energy values of level
2 for one active region and the black points refer to known �are times. From the
�gure, we conclude that the wavelet energy takes larger values prior to �ares in
the active region.
36
Figure 16: Energy values at 5 levels of wavelet decomposition for the image shown
in Figure 15(a).
Table 4: Features extracted from wavelet analysis.
Wavelet Features
Wavelet Energy L1 Wavelet Energy L2
Wavelet Energy L3 Wavelet Energy L4
Wavelet Energy L5
37
Figure 17: Energy values at level 2 for one active region and known �are times
shown in black points. We can conclude that the wavelet energy takes larger
values prior to �ares in the active region.
38
3 CLASSIFICATION, FEATURE SELECTION AND PERFORMANCE
MEASURES
In this chapter, we provide a brief overview of the two classi�cation methods used
in this work and explain the feature selection method used to select the optimal
features. Also, we will describe the skill score measures that we use to quantify
forcast performance for the classi�cation methods.
3.1 Fisher Linear Discriminant Analysis (FLDA)
Linear discriminant analysis is one of the methods used in statistics and pattern
recognition to �nd a linear combination of features which characterizes two or
more classes of objects or events. A discriminant is a function that takes an input
vector X and assigns it to one of K classes, denoted Ck. In the two class case, the
linear discriminant is a function obtained by taking a linear function of the input
vector so that
y(X) = wTX + wo (10)
where w is called a weight vector, and wo is a bias. Thus, we are projecting the
D-dimensional input vector X to one dimension and basing the classi�cation on
threshold wo [5].
In general, the projection onto one dimension leads to a considerable loss of
information. However, by adjusting the components of the weight vector w, we
39
can select a projection that maximize the class separation. If we have N1 points
of class C1 and N2 points of class C2, then the D-dimensional mean vectors of the
two classes are given by [5]:
m1 =1
N1
∑n∈C1
Xn, m2 =1
N2
∑n∈C2
Xn (11)
where Xn is the n-th component of the input vector X. The idea proposed by
Fisher [18] is to maximize a function that will give a large separation between
the projected class means wTm1 and wTm2 and also give a small variance within
each projected class, thereby minimizing the class overlap.
Figure 18, adapted from [5], represents the decision boundary found by FLDA
analysis between two classes. To put this generic description in the context of
solar phenomena, the �red x� class may represent �are-productive active regions
and the �blue x� class may be non-�aring regions, while the x- and y-axes are
features such as those listed in Tables 1 through 4.
3.2 Relevance Vector Machine (RVM)
The Relevance Vector Machine (RVM) is a Bayesian sparse kernel technique for
regression and classi�cation. The RVM classi�cation method basically depends
on �nding a kernel function K(xn, xm) for all possible pairs xn and xm of training
points, which can be computationally infeasible during training and can lead to
excessive computation times when making predictions for new data points. In the
40
Figure 18: Illustration of FLDA classi�cation for a two class case. Figure adapted
from [5].
kernel-based algorithms that have sparse solutions, the predictions for new inputs
depends only on the kernel function evaluated at a subset of the training data
points [5].
As mentioned by Tipping [63], in supervised learning a set of input vectors Xn
along with corresponding targets tn as n = 1, 2....N are given. The tn might be
discrete class labels in the case of classi�cation and might be real continuous values
in regression. From this training set we wish to learn a model of the dependency
of the targets on the inputs with the objectives of making accurate predictions of
t for previously unseen values of x. Typically, predictions are based upon some
function y(x) de�ned over the input space, and �learning� is the process of inferring
this function. A �exible and popular set of candidates for y(x) is that of the form:
y(x;w) =M∑i=1
wiφi(x) = wTφ(x) (12)
41
where the output is a linearly-weighted sum of M , generally nonlinear and �xed,
basis functions φ(x) = (φ1(x), φ2(x), ..., φM(x))T . Tipping [63] presents details
about the Bayesian probabilistic framework for learning general models of the
form in Equation 12. The key of that approach is that as well as o�ering good
generalization performance, the inferred predictors are �sparse� in that they con-
tain few non-zero wi parameters. The majority of parameters are automatically
set to zero during the learning process, giving a procedure that is extremely ef-
fective at discerning those basis functions which are �relevant� for making good
predictions. �Relevance vector machines� (RVMs) and �support vector machines�
(SVMs) are two speci�c types of sparse learning.
As an illustration of RVMs and their underlying predictive distributions, con-
sider Figure 19 as taken from [5]. This example considers the use of an RVM
for a classi�cation problem (set of discrete labels t). In Figure 19(a), data drawn
from two di�erent classes are shown as red and blue x's. Consider the x-axis and
y-axis to represent two features that have been measured from each of the data
points; thus, Figure 19(a) is a scatter plot of feature values. The black bound-
ary in Figure 19 represents the decision boundary determined by the RVM. The
unique strength of the RVM, however, is illustrated in Figure 19(b) where the
predictive distribution is represented as a colormap where the more red a region
is in the feature plane, the higher the probability that a data point occupying
that location is a member of the class represented by the red x's. Similarly, the
42
(a) Two-class dataset (red x's and blue
x's) with RVM classi�cation decision
boundary (black curve). From [5].
.
(b) Predictive distribution of the RVM
classi�er where more red regions indi-
cate higher probability of belonging to
the `red x' class and more blue regions
indicate higher probability of belonging
to the `blue x' class. From [5].
Figure 19: Illustration of RVM classi�cation for a two class case. (a) scatter
plot of feature values for two classes (b) predictive distribution represented as a
colormap. Figures taken from [5].
more blue a location in the feature plane, the higher the probability that a data
point occupying that location is member of the class represented by the blue x's.
Figure 19 represents the decision boundary found by RVM classi�cation. As we
mentioned for Figure 18 the �red x� class may represent �are-productive active
regions and the �blue x� class may be non-�aring regions, while the x- and y-axes
are features such as those listed in Tables 1 through 4.
43
3.3 Feature Selection
Feature selection is a process that selects the relevant and important features
from a large set of features. Pudil et al [52] de�ne the feature selection as a
search problem that detects an optimal feature subset based on some selected
measure. Liu et al [40] represent that feature selection is one of the important and
frequently used techniques in data preprocessing for data mining. Also it has many
advantages in reducing the number of features, removes irrelevant, redundant, or
noisy data, and can speed up data mining algorithms and improve predictive
accuracy.
We can de�ne four basic steps in a typical feature selection method [10], [40]:
(1) a subset generation procedure, (2) an evaluation function, (3) a stopping
criterion, (4) a validation procedure. Subset generation is a search procedure
that produces candidate feature subsets for evaluation based on a certain search
strategy; this step can start with no features, with all features or with a random
subset of features. Next each candidate subset is evaluated and compared with
the previous best one according to a certain evaluation criterion. If the new subset
turns out to be better, it will replace the previous best subset. The previous two
steps are repeated until a given stopping criterion is satis�ed. Finally, the selected
subset needs to be validated by prior knowledge or evaluation on a test dataset.
In the feature selection methods used by Pudil et al [52], the best feature
44
set is constructed by adding to and/or removing from the current feature set, a
small number of features at a time until the required feature set Xd of cardinality
d is obtained. There are two ways to select the starting subset. The �rst one
begins with an empty set X0 which will be successively built up and is known
as the �bottom up� or �sequential forward selection� (SFS) method. The second
way is to start with the complete set of features Y and is called �top down� or
�sequential backward selection� (SBS) method. Both of these methods su�er from
the �nesting e�ect� which means that in the case of the �top down� search the
discarded features cannot be re-selected while in the case of the �bottom up�
search the features once selected cannot be later discarded, so these methods are
suboptimal.
Pudil et al [52] present �oating search methods of feature selection which
overcome the nesting problem. Floating means to let the values ��oat�, keep them
�exibly changing so as to approximate the optimal solution much as possible.
Then the resulting dimensionality in respective stages of the algorithm is not
changing monotonically but is ��oating� up and down. These feature selection
methods are denoted by �sequential forward �oating selection� (SFFS) method
and the opposite direction called �sequential backward �oating selection� (SBFS)
method.
The SFFS method is basically a bottom up search procedure which applies
the basic SFS procedure starting from the current feature set followed by a series
45
of successive conditional exclusions of the worst feature in the newly updated set
assuming a further improvement can be made to the previous set [52]. The SBFS
method is a top down search procedure which excludes features using the basis
SBS method starting from the current feature set followed by a series of successive
conditional inclusions of the most signi�cant feature from the available features
if an improvement can be made to the previous set. These methods still cannot
guarantee optimally of the selected feature subset, but they have been shown to
perform very well compared to other feature selection methods, and much more
computationally e�cient [31]. In our work, we use the SFFS as a feature selection
method.
3.4 Performance Measures
Table 5 shows the contigency table (confusion matrix) where TP is the true posi-
tive (correct �are forcast), FN false negative (incorrect no-�are forcast), FP false
positive (incorrect �are forcast), and TN true negative (correct no-�are forcast) [6].
These quanti�ed measures will be used to compare the performance of �are pre-
diction using the classi�cation methods discusssed in Sections 3.1 and 3.2. In
particular, we will consider the accuracy of classifying �aring regions (TP) and
accuracy of classifying non-�aring regions (TN).
Since �ares are relatively rare events, the classi�cation of �are activity relies
on an unbalanced dataset, where the number of examples of non-�ares largely
46
Table 5: Flaring forcasting contingency table
Observed Forcasted
Flare No �are
Flare TP FN
No �are FP TN
outweighs the number of examples of �ares. We will return to this issue in chap-
ter 4. As an example of the unbalanced data, for a 4 hour timescale, 6.5% of the
total dataset belong to �are regions and 93.5% of the total dataset belong to no
�are regions.
The use of skill scores attempts to alleviate some of the issues of unbalanced
data through di�erent combinations of the contingency table entries. Many dif-
ferent skill scores exist to quantify forcast performance, but the Heidke skill score
(HSS) and the Hanssen & Kuipers discrimenant known as the True skill score
(TSS) are the most widely used in �are forcasting [6]. HSS and TSS are both
mathmetical relations depending on the �are forecast contingency table [6], [68].
HSS is de�ned as:
HSS =2[(TP × TN)− (FN × FP )]
(TP + FN)(FN + TN) + (TP + FP )(FP + TN)(13)
and TSS is given by:
TSS =TP
TP + FN− FP
FP + TN(14)
47
Only TSS is unbiased when confronted with varying observed event/no-event sam-
ple ratios. TSS is preferred to use with the unbalanced dataset as it is not sensitive
to the active region sample ratio [6].
48
4 EXPERIMENTS AND RESULTS
We will use both FLDA and RVM classi�ers to predict whether a given AR will
�are in the following k hours. We will �rst describe the experimental setup com-
mon to both methods, followed by results and discussion for each classi�cation
method, presented across timescales. Then, in the last section, the optimal fea-
tures chosen by feature selection from the original 35 features and the accuracy
of classi�cation using a group of the optimal features will be compared with the
previous FLDA and RVM results.
4.1 Experiment setup
Our goal is to classify an active region to class C1 if it will �are in the subsequent
k hours and to class C2 if it will not �are in the subsequent k hours. From
the image analysis discussion in Chapter 2, we end with one feature matrix for
each active region. These feature matrices are concatenated into one matrix for
all active regions to be the input data matrix to the classi�cation process. The
input feature matrix X is de�ned by: X = {X1, X2, .., XN} where N is the total
number of active regions. Xi is the feature matrix of the i-th active region with a
dimensionality 35 × ni where ni is the number of images for the i-th AR. These
35 features encompass the gradient, fractal dimension, neutral line, emerging �ux
region, and wavelet features as discussed in Chapter 2.
49
In addition to this feature matrix, training of the classi�ers requires a label
vector. Each element in the label vector indicates whether the AR represented by
that image will �are in the next k hours (`1') or not (`0'). Flares are de�ned per
the GOES catalog which de�nes �ares according to their total x-ray �ux [66].
The classi�cation process follows two steps: training and testing. We randomly
choose 1000 active regions to train and �nd weight vector w. The remaining 1000
active regions are used in testing, where weight vector w is used to predict classes
for each data point in X, representing an active region image.
Since a large majority of regions will not �are within the time window consid-
ered, classi�cation methods can naively optimize their criterion by classifying all
regions as class C2 (no �are). One method to alleviate this issue of unbalanced
datasets is to arti�cially balance the dataset by subsampling one or both classes
to be evenly represented. By cross validation across many randomly balanced
datasets, we can get a better idea of accuracy. In this work, we use a 10-fold
cross-validation with 100 samples (subsampled from the 1000 training ARs) for
�aring and non-�aring populations.
The classi�cation process is repeated for di�erent timescales from 2 to 24 hours
prior to a �are in a steps of 2 hours (i.e 2,4,6,....,24). It should be noted that by
�time before a �are� we are refering to the classi�cation of whether a �are will
occur in the subsequent k hours.
50
4.2 Classi�cation using Fisher Linear Discriminant Analysis
4.2.1 Classi�cation Using All Features
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 20: FLDA classi�cation results using a combination of all features.
Figure 20 (a) shows the �aring and non-�aring accuracies for classi�cation
of a randomly selected 1000 active regions using the Fisher linear discriminant
analysis discussed in Section 3.1. These accuracies are computed for a range of
timescales from 2 to 24 hours. Figure 20 (b) shows the skill score measures at each
timescale. From these �gures, we conclude that the FLDA classi�cation method
gives higher accuracies in predicting �aring active regions than non-�aring active
regions. TSS and HSS values seem to be stable but have low values in the range
between 0.003 to 0.2. The best published TSS values are >0.4 [6].
As a conclusion of FLDA classi�cation using all features, we notice that there
is no obvious trend in accuracy performance versus timescales and potentially a
51
slight increase in TSS for larger timescales.
4.2.2 Classi�cation Using Feature Subsets
Up to this point, we have considered the use of all features described previously
in Section 2 and listed in Tables 1 through 4. We can separate the features and
classify using a subset of features, for example the 7 gradient features as shown
in Figure 21. In a similar manner, classi�cation using other feature subsets as
discussed in Section 2 are shown in Figures 22-25. Our goal here is to determine
which subsets have better accuracy and to postulate the physical relation between
features and active region �aring.
From Figure 21 (a), we �nd that gradient features are more accurate at classi-
fying no �are activity. Possibly a lack of large gradient is indicative of no imminent
�ares, but a large gradient is not necessarily indicative of future �aring. Figure 21
(b) shows that TSS preformance is worse at < 10 hours but after that it has val-
ues within range of best published values [6]. This is surprising since it indicates
better predictions at > 10 hours and at other times it has a good TSS values while
classifying all regions as non-�aring as seen at 22 hours case. This is not clear
why it happens since we have a 10-fold cross validation.
NL features have more consistent accuracy for �aring and non-�aring regions
as shown in Figure 22 (a). A better skill scores is noted at longer timescales of
prediction in Figure 22 (b).
52
The fractal dimension feature can predict �aring activity more accuratly than
non-�aring activity as shown in Figure 23 (a), while it has small skill score values
as in Figure 23 (b). Again and as noted for the gradient features case, TSS has a
better value when classi�cation predict all regions as �aring as at 22 hours in the
timescale.
Figure 24 (a) shows the EFR classi�cation results; we can see that the EFR
features tend to result in classi�ers that naively classify all regions as either �aring
or not �aring. This may indicate that EFR features, at least by themselves, are
not good indicators of future �are activity. Because of that, the skill scores have
relatively low values.
From Figure 25 (a), we conclude that wavelet features have more consistent
and higher accuracies for �aring and non-�aring regions and it has a good TSS and
HSS values after 6 hours of the timescale, which is within the published range [6]
as in Figure 25 (b).
We conclude that NL and wavelet features have the best performance in pre-
dicting future �are activity. As future work for this part, we will relate the per-
formance of the feature subsets back to the physical process, in collaboration with
solar physicists. Also, we will try to explain the general trend for some feature
subsets where the skill scores increases with increasing timescales.
53
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 21: FLDA classi�cation results using gradient features listed in Table 1.
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 22: FLDA classi�cation results using neutral line features listed in Table 2.
54
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 23: FLDA classi�cation results using the fractal dimension feature.
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 24: FLDA classi�cation results using emerging �ux region features listed
in Table 3.
55
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 25: FLDA classi�cation results using wavelet features listed in Table 4.
56
4.3 Classi�cation using Relevance Vector Machine
4.3.1 Classi�cation Using All Features
Figure 26 (a) shows the �aring and non�aring accuracies for classi�cation of 1000
randomly chosen active regions with respect to di�erent timescales using the rel-
evance vector machine analysis discussed in Section 3.2. Figure 26 (b) shows the
skill score measures at each timescale. We note more consistency of the �aring
and non-�aring accuracies over the range of 2 to 22 hours as compared to that of
the FLDA (Figure 20). In addition to consistency, the accuracies of �aring and
non-�aring prediction are close to each other and have higher values (between
0.6 to 0.8) than seen with FLDA. TSS and HSS values have values in the range
between 0.1 and 0.4 which is good and acceptable.
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 26: RVM classi�cation results using a combination of all features.
57
4.3.2 Classi�cation Using Feature Subsets
Similar to the feature subset analysis for FLDA we can separate the features and
classify using a subset of features using the RVM classi�er. Classi�cation using
feature subsets as discussed in Section 2 are shown Figures 27-31. As we mentioned
before, the aim from this step is to determine which subsets have better accuracy
and to �nd the physical relation between features and active region �aring.
From Figure 27 (a), we note that gradient is a little more accurate in no-�aring
prediction than �aring. Both accuracies and skill scores results are not consistent
and classify all regions as no �are with high TSS vlaues at some timescales like
16-20 hours. That could be avoided if we use more cross validation than 10 for
future analysis.
Classi�cation using NL features is shown in Figure 28 (a). NL features have
consistent accuracies for no-�aring regions and higher than �aring. Also, it is very
close to FLDA classi�cation in Figure 22 (a). TSS and HSS trends increase with
increasing timescales (Figure 28 (b)) and close to FLDA skill scores (Figure 22
(b)).
Figure 29 shows RVM classi�cation using the fractal dimension feature. We
can see that FD always classi�es regions as non-�aring regions and skill scores
values are very small and close to zero. This result may indicate that FD is not
good in future �are prediction, or that is not good to use the FD feature alone to
58
predict �ares.
EFR �aring and non-�aring accuracies are shown in Figure 30 (a), EFR is
better for no-�aring prediction. Also, we note more consistency in �aring and
non-�aring accuracies than FLDA classi�cation (Figure 24 (a)). Skill scores have
low values but consistent (Figure 30 (b)).
From Figure 31 (a) we conclude that wavelet features have good prediction of
non-�aring regions while the �aring accuracies is not bad. Skill scores in Figure 31
(b) increase with larger timescales with a good and acceptable values. For future
work, we will relate the performance of the feature subsets back to the physical
process to explain the general trend for some feature subsets where the skill scores
increases with increasing timescales.
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 27: RVM classi�cation results using gradient features listed in Table 1.
59
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 28: RVM classi�cation results using neutral line features listed in Table 2.
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 29: RVM classi�cation results using fractal dimension feature.
60
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 30: RVM classi�cation results using emerging �ux region features listed in
Table 3.
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 31: RVM classi�cation results using wavelet features listed in Table 4.
61
4.4 Classi�cation after Feature Selection
In the previous section, we found that some of the 5 feature subsets yielded better
accuracies and skill score performance. That choice of 5 subsets was arbitrary
according to the underlying algorithms. In this section, we seek to obtain a
feature subset that is optimal for the classi�cation task.
We choose the �sequential forward �oating selecting� (SFFS) method with
Fisherc criterion type to select the optimal feature set from the original features
discussed in Section 2 using the implementation found in the PRTools Matlab
package [11]. Since we are faced with an unbalanced dataset, and we use cross-
validation, the question is how to use feature selection in such a framework. Each
cross validation run will result in a di�erent optimal feature subset, but we hope
that there will be some consistency amongst the features selected over the dif-
ferent validations. Thus we must carefully de�ne what we mean by an �optimal�
feature subset under these conditions. While it has been shown that SFFS closely
approximates the optimal feature subset [6], by somehow combining multiple op-
timal feature sets, we cannot gurantee any sort of global optimality. However,
we will choose a subset of features which is expected to perform better than the
entire feature set, and refer to this subset as optimal. To choose optimal features,
we follow the process outlined below.
We randomly choose 1000 active regions to train using 500 samples from each
62
Figure 32: Histogram of features selected at 14 hours timescale ranked from least
frequent at 1 to most frequent at 35.
class in order to balance the data. This process is repeated 100 times to make
sure of our selection (100-fold cross validation), then the histogram of all features
is plotted which shows how many times each feature is selected as an optimal
feature. This process is repeated for all the timescales [2,24] hours, Figure 32
shows an example of this feature histogram at 14 hours timescale. Table 6 also
presents the names of the top 16 ranked features (labeled with 20 to 35 on the
x-axis of Figure 32). For example �NL Gradient� is selected 88 times from the 100
cross validations and �NL no Fragments� and �Gradient Std� are both selected 79
times and so on.
4.4.1 FLDA Classi�cation on Optimal Subset
The same classi�cation process as in Section 4.2 is used but the subset of optimal
features is used instead of all the features. The accuracy of �aring and non-�aring
63
Table 6: The top 16 ranked features at 14 hours timescale.
Top 16 ranked features from the histogram in Fig 32
35. NL Gradient 27. EFR Gradient
34. NL no Fragments 26. NL Curvature Max
33. Gradient Std 25. NL Curvature Min
32. Skewness 24. EFR Median
31. Gradient Median 23. EFR Mean
30. kurtosis 22. EFR AbsSum
29. NL Bendingenergy Median 21. EFR Std
28. Fractal dimension 20. EFR Sum
active regions while classifying using the top 6 ranked features at each timescale
are shown in Figure 33(a) while the skill score measures are shown in Figure 33(b).
We notice that the overall accuracies are larger than the accuracies when we use
all features as in Figure 20(a).
There are many ways to choose the number of optimal feature uses in the
feature subset, here we try di�erent subsets and we �nd that classi�cation using
the top 6 ranked features gives clear and good improvement in the �aring and non-
�aring accuracies. The feature selection process improves the prediction accuracies
of the FLDA classi�cation method in both �aring and non-�aring cases. However,
HSS and TSS measures are not as consistent and still maintain low values.
64
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 33: FLDA classi�cation results using 6 top-ranked features.
4.4.2 RVM Classi�cation on Optimal Subset
The same classi�cation process as in Section 4.3 is used but using a new subset
with optimal features. The accuracy of �aring and non-�aring active regions are
shown in Figure 34(a) while the skill score measures are shown in Figure 34(b).
The feature selection process improves RVM classi�cation speed as we have fewer
features (i.e, the feature matrix X is smaller in size). The time to classify the
same number of active regions takes now one minute as opposed to 2-3 minutes.
However, the accuracies for RVM and FLDA classi�cation appear more consistent
across timescales when we used all features (see Figures 20 and 26).
65
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 34: RVM classi�cation results using 6 top-ranked features.
4.4.3 Determination of an Appropriate Number of Optimal Features
To get more information about the accuracy and skill score values after choosing
an optimal feature subset for classi�cation, we include another example of RVM
classi�cation using the top 10 and 3 optimal features as shown in Figures 35
and 36. We note from Figure 35 that RVM consistency is absent as the accuracies
go up and down over the timescale. Nevertheless, TSS and HSS values looks good
and stable.
Figure 36 shows the classi�cation results of using the 3 top-ranked features.
We choose 3 features because at di�erent timescales, we noticed that the top 3
ranked features are mostly the same: �Gradient Std�, �NL no Fragments� and �NL
Gradient�. It is interesting to see the feature (�Gradient Std�) as one of the top
ranked features, because Figure 3 shows how this feature is related to future �ares
66
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 35: RVM classi�cation results using 10 top-ranked features.
for one active region. And as expected, it gives a good indication about future
�are prediction. Figure 36 (a) shows more consistency in �aring and non-�aring
accuracies than Figure 35 (a) especially between 6 and 20 hours timescales. The
TSS and HSS values also have good trends between 6 and 20 hours timescales as
shown in Figure 36 (b).
To get a close look at skill score improvement versus number of optimal features
selected, TSS values are calculated at one timescale (e.g., at 14 hours before
a �are) for di�erent size subsets, begining with the most optimal, and adding
features in decreasing rank until all 35 features are being used. We begin with the
3 top-ranked features (�Gradient Std�, �NL no Fragments� and �NL Gradient�),
as these features are the top 3 optimal features at di�erent timescales. Figure 37
illustrates the TSS values versus number of features used in classi�cation for the
RVM classi�er for a timescale of 14 hours. It is noticable that the maximum value
67
(a) Accuracy of �aring and non-�aring
ARs.
(b) Skill score (HSS and TSS) values.
Figure 36: RVM classi�cation results using 3 top-ranked features.
of TSS is when we classify the active regions using a feature set with only the top
3 optimal features. The overall trend in TSS in Figure 37 decreases as the size of
the feature subset increases. The trend is not strictly monotonic, most likely due
to the use of an optimal subset chosen over several cross-validation runs.
From Sections 4.2 and 4.3 and by comparing Figures 20 and 26, we conclude
that the RVM classi�cation method has a more accurate and consistent perfor-
mance than FLDA classi�cation. The RVM method can predict both �aring and
non-�aring active regions at each time before �are cases much better than the
FLDA method. TSS and HSS values result for RVM classi�cation have higher
values (between 0.1 and 0.4) than FLDA. An advantage for FLDA that it is faster
and takes a few seconds whereas the RVM process takes a few minutes.
68
Figure 37: TSS values at 14 hour before �are case using di�erent features subsets.
69
5 CONCLUSION
In this work, a large magnetogram dataset were used to extract 35 di�erent
features that describe the physical properties of active region magnetic �elds using
5 di�erent analysis: 1. gradient analysis: which is an indicative of pressure build-
up in the photosphere, 2. neutral line: the line seperate opposit polarities at the
magnetic �eld which is related to energy release locations, 3. fractal dimension:
which relates to the active region complexity, 4. emerging �ux region: which can
act as energy release triggers, and 5. wavelet analysis: which allows separation of
the �eld into its component length scales.
Next, we used the extracted features to classify active regions as a �aring or
non-�aring regions in the coming k hours. Two classi�cation methods have been
used and the accuracies of �aring and non-�aring ARs along with the skill score
measures were found and compared. We found that the Relevance Vector Machine
(RVM) method of classi�cation was better in �aring and non-�aring prediction
than the Fisher Linear Discrimenant (FLDA) method. Also, skill score values
result for RVM classi�cation have higher and more consistent values than FLDA.
An advantage for FLDA that it is faster and takes few second whereas RVM takes
few minutes.
As a conclusion of the classi�cation using all features, for FLDA classi�cation
method, we noticed that there is no obvious trend in accuracy performance versus
70
timescales and TSS had slight increase for larger timescales. But, for RVM classi-
�cation method, we note more consistency of the �aring and non-�aring accuracies
over the range of 2 to 22 hours as compared to that of the FLDA. In addition to
consistency, the accuracies were close to each other and have higher values than
seen with FLDA. Also, TSS and HSS values were good and acceptable.
On the other hand, some features had a good relation with future �are ac-
tivities and gives a high �aring and non-�aring accuracies while others are not.
FLDA classi�cation using gradient features subset was more accurate at classify-
ing no �are activity. Possibly a lack of large gradient is indicative of no imminent
�ares, but a large gradient is not necessarily indicative of future �aring. Using
the EFR features subset result with a classi�er that naively classify all regions as
either �aring or not �aring, which may indicate that the EFR features are not
good indicator of future �are activity. However, the NL and the wavelet features
have the best performance in predicting future �are activity.
After RVM classi�cation using features subset, we noticed that both gradient
and NL features had consistent accuracies for no-�aring prediction and higher
than �aring and it is very close to the FLDA classi�cation results. However, we
found that the FD feature always classi�es regions as non-�aring regions and skill
score values are very small and close to zero. This may indicate that the FD is
not good in future �are prediction, or it is not good to use the FD feature alone
to predict �ares. Finally, the EFR and wavelet features were noticed to have a
71
good prediction of non-�aring regions while the �aring accuracies is not bad.
In feature selection, it is important to reminde that the process was repeated
100 times (100-fold cross validation) and the histogram of all featurers was plotted
which shows how many times each feature was selected as an optimal feature. That
procedure was also repeated for all timescales [2,24] hours. Then both the FLDA
and the RVM classi�cation methods were used to classify active regions using the
top 6 ranked features. Also, a subset includes 3 top-ranked features was used
because, at di�erent timescales, we noticed that the top 3 ranked features are
mostly the same: �Gradient Std�, �NL no Fragments�, and �NL Gradient�. It is
interesting to see the feature (�Gradient Std�) as one of the top ranked features,
because Figure 3 shows how this feature is related to future �ares for one active
region.
The feature selection process improves RVM classi�cation speed. However,
the accuracies for RVM and FLDA classi�cation appear more consistent across
timescales when we used all features in classi�cation. RVM classi�cation using the
top 3 ranked features had more consistency in �aring and non-�aring accuracies
than classi�cation using 6 top-ranked features and the skill score values had a
good trends between 6 and 22 hours timescales.
72
6 FUTURE WORK
There are several avenues for potential future work. In terms of the image
analysis work, we may consider the use of additional features from the solar analy-
sis literature or general feature extraction literature. While this has the potential
to provide an increase in performance, the results achieved with the 35 features
used in this work are encouraging. As such, we will �rst focus our attention on
improvement of the statistical modeling in the classi�cation.
It will be an important step to relate these analysis back to the physical pro-
cesses underlying �are activity. As such, we want to get some physical explanation
of the features behaviour related to their result accuracies of �aring and non-�aring
classi�cation as we found that some of the features are good in �aring prediction
while others are not.
In relation to the classi�cation methods, we can provide better probabilistic
models by considering a priori distributions of �are activities (to better model the
rarity of �ares). We also plan to extend the classi�cation work presented here
(i.e., discrete labels) to a regression analysis (i.e., continuous labels). We expect
that this will provide a more natural framework for �are prediction, since �ares
are known to occur across a continuum of energy levels. We will use Relevance
Vector Machine (RVM) regression or Support Vector Machine (SVM) regression
methods to classify active regions as �aring regions with �are type A,B,C,M or
73
X-type or non-�aring regions.
Additionally, we want to determine a relationship or mapping between coronal
features and photospheric magnetic �eld to get more information and to extract
more features related to the active region's magnetic �eld complexity. The rela-
tionship of features extracted from di�erent solar layers may provide important
insight into the physical mechanisms of solar activity.
74
APPENDICES
APPENDIX A
MATLAB CODE
A MATLAB CODE
A.1 Gradient Analysis Code
clear a l l
close a l l
clc
base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
5 data_directory = dir(base_directory );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for p =3: length(data_directory)
Data_directory = data_directory(p).name;
filenames = dir ([ base_directory ,Data_directory ,'/*. fits']);
10
Gradient_mean =[]; Gradient_std =[]; Gradient_max =[]; Gradient_min =[];
Gradient_median =[]; no_of_images =[]; Gradient_skewness =[]; Gradient_kurtosis =[];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% M a g n e t o g r a m i m a g e s l o o p :
15 for k = 1: length(filenames)
filename = filenames(k).name;
A = fitsread ([ base_directory ,Data_directory ,'/',filename],'raw');
i f A(end,1) <-3000
A (A==A(end,1))= NaN;
20 end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% H e a d e r i n f o r m a t i o n : i g n o r e t h e i m a g e s w h i c h h a v e a r a d i u s ( d i s t a n c e
% f r o m AR c e n t e r to d i s k c e n t e r ) g r e a t e r t h a n 6 5 0 a r c s e c o n d s .
hdr = fitsinfo ([ base_directory ,Data_directory ,'/',filename ]);
25 hdr.PrimaryData.Keywords;
radius = sqrt(cell2mat(hdr.PrimaryData.Keywords (187 ,2))^2 +...
cell2mat(hdr.PrimaryData.Keywords (188 ,2))^2);
i f radius > 650
77
A=[];
30 else
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% H e r e is t h e g r a d i e n t m a g n i t u d e c o d e :
w= [-1 0 1;-2 0 2;-1 0 1]; % s o b e l m a s k s
wm = [-1 -2 -1;0 0 0;1 2 1];
35 s = imfilter (A,w,'replicate '); % f i l t e r i n g
g = imfilter (A,wm ,'replicate ');
grad_image = sqrt(s.^2 + g.^2); % t h e r e s u l t g r a d i e n t i m a g e
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% T h e s e v e c t o r s c o n t a i n v a l u e s of std , mean , a n d m a x f o r a l l g r a d i m a g e s :
40 Gradient_mean= [Gradient_mean mean(mean(grad_image ))];
Gradient_std = [Gradient_std std(std(grad_image ))];
Gradient_median = [Gradient_median median(median(grad_image ))];
Gradient_min = [Gradient_min min(min(grad_image ))];
Gradient_max = [Gradient_max max(max(grad_image ))];
45 Gradient_skewness = [Gradient_skewness skewness(skewness(grad_image ))];
Gradient_kurtosis = [Gradient_kurtosis kurtosis(kurtosis(grad_image ))];
no_of_images = [no_of_images k]; % n u m b e r of i m a g e s
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end
50 end
Active_Region_number = Data_directory
Gradient_features = [Gradient_mean; Gradient_std; Gradient_median;...
Gradient_min; Gradient_max; Gradient_skewness;...
Gradient_kurtosis ];
55 disp(['save at:',base_directory ,Data_directory ,'/','_Gradientfeatures.mat'])
save([ base_directory ,Data_directory ,'/','_Gradientfeatures.mat'],...
'Gradient_features ');
end
78
A.2 Neutral Line Analysis Code
clear a l l
close a l l
clc
base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
5 data_directory = dir(base_directory );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for p =3: length(data_directory)
Data_directory = data_directory(p).name;
filenames = dir ([ base_directory ,Data_directory ,'/*. fits']);
10 NL_Length =[]; NL_no_Fragments =[]; NL_Gradient =[]; NL_Curvature_mean =[];
NL_Curvature_std =[]; NL_Curvature_max =[]; NL_Curvature_min =[];
NL_Curvature_median =[]; NL_Bendingenergy_mean =[]; NL_Bendingenergy_std =[];
NL_Bendingenergy_max =[]; NL_Bendingenergy_min =[]; NL_Bendingenergy_median =[];
no_of_images =[];
15 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% M a g n e t o g r a m i m a g e s l o o p :
for k = 1: length(filenames)
filename = filenames(k).name;
A = fitsread ([ base_directory ,Data_directory ,'/',filename],'raw');
20 i f A(end,1) <-3000
A (A==A(end,1))= NaN;
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% H e a d e r i n f o r m a t i o n : i g n o r e t h e i m a g e s w h i c h h a v e a r a d i u s ( d i s t a n c e
25 % f r o m AR c e n t e r to d i s k c e n t e r ) g r e a t e r t h a n 6 5 0 a r c s e c o n d s .
hdr = fitsinfo ([ base_directory ,Data_directory ,'/',filename ]);
hdr.PrimaryData.Keywords;
radius = sqrt(cell2mat(hdr.PrimaryData.Keywords (187 ,2))^2 +...
cell2mat(hdr.PrimaryData.Keywords (188 ,2))^2);
30 i f radius >650
79
A=[];
else
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 1. F i l t e r i n g :
35 D = std(std(abs(A)));
f i l t e r = fspecial('average ' ,10);
filter_A = imfilter(double(A), f i l t e r , 'replicate ');
% F i x N a N file , L E B
i f sum(sum( isnan(filter_A ))) == s ize (A,1)* s ize (A,2)
40 filter_A = randn( s ize (filter_A ));
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 2. C o n t o u r ( b o u n d a r i e s )
[C,H]= imcontour(filter_A ,[0 ,0]);colorbar;
45 m = C(1 ,:)~= 0;
x = C(1,m); y = C(2,m);
i = sub2ind( s ize (A),round(y),round(x));
C_im = zeros( s ize (A));
C_im(i) = 1;
50 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 3. G r a d i e n t :
w= [-1 0 1;-2 0 2;-1 0 1];
wm = [-1 -2 -1;0 0 0;1 2 1];
s = imfilter (double(A),w,'replicate ');
55 g = imfilter (double(A),wm,'replicate ');
grad_A = sqrt(s.^2 + g.^2);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% M u l t i p l y t h e g r a d i e n t i m a g e w i t h t h e c o n t o u r i m a g e
neutral_A =( grad_A ).*( C_im);
60 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% F i n d t h e l e n g t h of t h e n e u t r a l l i n e
80
% P e r c e n t a g e t h r e s h o l d i n g 2 0 % t h r e s h o l d i n g :
alfa = 0.1; % l e s s t h a n 1 / 3
I_max = max(max(neutral_A ));
65 I_min = min(min(neutral_A ));
level1 = alfa*(I_max -I_min)+I_min; % 1 0 % t h r e s h o l d i n g
level2 = 2* level1; % 2 0 % t h r e s h o l d i n g
thresh2 = max(neutral_A ,level2 .*ones( s ize (neutral_A ))); % N e u t r a l l i n e i m a g e .
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
70 small= min(min(thresh2 ));
binary_thresh2 = thresh2 > small; % b i n a r y i m a g e
ON_pixels = find(binary_thresh2 == 1);
[m,n]= s ize (ON_pixels );
NL_Length = [NL_Length m*n];
75 % N u m b e r of f r a g m e n t s or o b j e c t s on t h e n e u t r a l l i n e :
[L,ss] = bwlabel(binary_thresh2 ,8); % 8 c o n n e c t e d
NL_no_Fragments =[ NL_no_Fragments ss];
% W e i g h t e d NL :
weighted = binary_thresh2 .* grad_A;
80 NL_Gradient = [NL_Gradient sum(sum(weighted ))];
no_of_images = [no_of_images k]; % n u m b e r of i m a g e s
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% T h i s f u n c t i o n c o m p u t e s t h e b o u n d a r y c u r v a t u r e a n d b e n d i n g e n e r g y
conn =4;
85 B = bwboundaries(binary_thresh2 ,conn);
Curvature = [];
BendingEnergy = [];
for g = 1: length(B)
Boundary = B{g};
90 curvature = atan2(- d i f f (Boundary (:,1)), d i f f (Boundary (: ,2)));
Curvature = [Curvature ; curvature ];
bendingenergy = sum( d i f f (curvature ).^2)/ length(curvature );
81
BendingEnergy = [BendingEnergy ; bendingenergy ];
end
95 i f length(B)==0 % L E B
Curvature = [Curvature ; 0];
BendingEnergy = [BendingEnergy ; 0];
end
% C u r v a t u r e F e a t u r e s :
100 NL_Curvature_mean =[ NL_Curvature_mean mean(Curvature )];
NL_Curvature_std =[ NL_Curvature_std std(Curvature )];
NL_Curvature_median =[ NL_Curvature_median median(Curvature )];
NL_Curvature_min =[ NL_Curvature_min min(Curvature )];
NL_Curvature_max = [NL_Curvature_max max(Curvature )];
105 % B e n d i n g E n e r g y F e a u t e r s :
NL_Bendingenergy_mean =[ NL_Bendingenergy_mean mean(BendingEnergy )];
NL_Bendingenergy_std =[ NL_Bendingenergy_std std(BendingEnergy )];
NL_Bendingenergy_median =[ NL_Bendingenergy_median median(BendingEnergy )];
NL_Bendingenergy_min =[ NL_Bendingenergy_min min(BendingEnergy )];
110 NL_Bendingenergy_max =[ NL_Bendingenergy_max max(BendingEnergy )];
end
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
NL_features =[ NL_Length;NL_no_Fragments;NL_Gradient;NL_Curvature_mean;...
115 NL_Curvature_std;NL_Curvature_median;NL_Curvature_min;...
NL_Curvature_max;NL_Bendingenergy_mean;NL_Bendingenergy_std;...
NL_Bendingenergy_median;NL_Bendingenergy_min;NL_Bendingenergy_max ];
disp(['save at:',base_directory ,Data_directory ,'/','_NLfeatures.mat'])
save([ base_directory ,Data_directory ,'/','_NLfeatures.mat'],'NL_features ');
120 end
82
A.3 Fractal Dimension Analysis Code
clear a l l
close a l l
clc
base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
5 ARs = dir(base_directory );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for p = 3: length(ARs)
AR = ARs(p).name;
filenames = dir ([ base_directory ,AR ,'/*. fits']); FD=[];
10 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% M a g n e t o g r a m i m a g e s l o o p :
for k = 1: length(filenames)
filename = filenames(k).name;
A = fitsread ([ base_directory ,AR,'/',filename],'raw');
15 i f A(end,1) <-3000
disp('Here!');
A(A==A(end,1))=NaN;
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
20 % H e a d e r i n f o r m a t i o n : i g n o r e t h e i m a g e s w h i c h h a v e a r a d i u s ( d i s t a n c e
% f r o m AR c e n t e r to d i s k c e n t e r ) g r e a t e r t h a n 6 5 0 a r c s e c o n d s .
hdr = fitsinfo ([ base_directory ,AR,'/',filename ]);
hdr.PrimaryData.Keywords;
radius = sqrt(cell2mat(hdr.PrimaryData.Keywords (187 ,2))^2 +...
25 cell2mat(hdr.PrimaryData.Keywords (188 ,2))^2);
i f radius >650
A=[];
else
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
30 % 1. F i l t e r i n g : a v e r a g e f i l t e r , s i z e 10 x 1 0
83
f i l t e r = fspecial('average ' ,10);
filter_A = imfilter(double(A), f i l t e r , 'replicate ');
% F i x N a N file , L E B
i f sum(sum( isnan(filter_A ))) == s ize (A,1)* s ize (A,2)
35 filter_A = randn( s ize (filter_A ));
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 2. C o n t o u r ( b o u n d a r i e s )
[C,H]= imcontour(filter_A ,[0 ,0]);colorbar; % s h o w t h e b o u n d e r i e s
40 m = C(1 ,:)~= 0;
x = C(1,m); y = C(2,m);
i = sub2ind( s ize (A),round(y),round(x));
C_im = zeros( s ize (A));
C_im(i) = 1;
45 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 3. G r a d i e n t of A ( o r i g i n a l i m a g e ):
w= [-1 0 1;-1 0 1;-1 0 1];
wm = [-1 -1 -1;0 0 0;1 1 1];
s = imfilter (double(A),w,'replicate ');
50 g = imfilter (double(A),wm,'replicate ');
f_A = sqrt(s.^2 + g.^2);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% m u l t i p l y t h e g r a d i e n t i m a g e w i t h t h e c o n t o u r i m a g e
Neutral_line =(f_A ).*( C_im); % t h i s is t h e n e u t r a l l i n e i m a g e
55 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 1. P e r c e n t a g e t h r e s h o l d i n g :
alfa = 0.1; % l e s s t h a n 1 / 3
I_max = max(max(Neutral_line ));
I_min = min(min(Neutral_line ));
60 level1 = alfa*(I_max -I_min)+I_min; % 1 0 % t h r e s h o l d i n g
level2 = 2* level1; % 2 0 % t h r e s h o l d i n g
84
thresh2 = max(Neutral_line ,level2 .*ones( s ize (Neutral_line ))); % N e u t r a l l i n e .
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
small= min(min(thresh2 ));
65 binary_thresh2 = thresh2 > small; % NL b i n a r y i m a g e
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% F r a c t a l D i m e n s i o n C a l c u l a t i o n
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 1. C r e a t a s t r u c t u r e : f i r s t l y d i s k s h a p e
70 SE=[]; Area_Dilate =[]; Radius =[];
for R=1:10
SE = [SE strel('disk',R,6)];
Dilate_image = imdilate(binary_thresh2 ,SE);
Area_Dilate =[ Area_Dilate bwarea(Dilate_image )]; % F i n d t h e a r e a a f t e r d i l a t e d
75 Radius= [Radius R];
end
Radii_of_strctr= log(Radius );
Areas_Dilate= log(Area_Dilate );
% 2. F i t a s t r a i g h t l i n e b e t w e e n t h e a r e a s of t h e d i l a t e d i m a g e a n d r a d i i of d i s k .
80 p =polyf it (Areas_Dilate ,Radii_of_strctr ,1);
FD =[FD 2-p(1 ,1)]; % F R A C T A L D I M E N S I O N V A L U E FD =2− S L O P E ( l o g ( a r e a )/ l o g ( r a d i i ))
end
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
85 FD_feature =FD;
disp(['saving ',base_directory ,AR,'/','_FDfeatures.mat']);
maximum_FD = max(FD_feature)
minimum_FD = min(FD_feature)
save([ base_directory ,AR,'/','_FDfeatures.mat'],'FD_feature ');
90 end
85
A.4 Emerging Flux Region Analysis Code
clear a l l
close a l l
clc
base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
5 data_directory = dir(base_directory );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for p = 3: length(data_directory)
Data_directory = data_directory(p).name;
filenames = dir ([ base_directory ,Data_directory ,'/*. fits']);
10 no_of_images =[]; EFR_Gradient =[]; EFR_AbsGradient =[]; EFR_Area_3sigma =[];
EFR_Sum =[]; EFR_AbsSum =[]; EFR_std =[]; EFR_mean =[];
EFR_min =[]; EFR_max =[]; EFR_median =[]; newfiles =[];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% R e a r r a n g e t h e n a m e s of i m a g e s in e a c h a c t i v e r e g i o n a n d c r e a t a n e w
15 % v e c t o r h a s t h e n a m e s of a l l i m a g e s w i t h r a d i u s <= 6 5 0 to m a k e s u r e we
% u s e t h e s a m e i m a g e s u s e d in o t h e r a l g o r i t h m s .
for k = 1:( length(filenames ))
filename=filenames(k).name;
F = fitsread ([ base_directory ,Data_directory ,'/',filename ]);
20 i f F(end,1) <-3000
F(F==F(end,1))=0;
end
hdr = fitsinfo ([ base_directory ,Data_directory ,'/',filename ]);
hdr.PrimaryData.Keywords;
25 radius = sqrt(cell2mat(hdr.PrimaryData.Keywords (187 ,2))^2 +...
cell2mat(hdr.PrimaryData.Keywords (188 ,2))^2);
i f radius >650
F=[];
else
30 newfiles =[ newfiles;filename ];
86
end
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for x = 1: s ize (newfiles ,1)-1
35 % T h e F i r s t i m a g e
filename1 = newfiles(x,:);
A = fitsread ([ base_directory ,Data_directory ,'/',filename1 ]);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% T h e n e x t i m a g e
40 filename2 = newfiles(x+1,:);
B = fitsread ([ base_directory ,Data_directory ,'/',filename2 ]);
% T h e d i f f e r e n c e i m a g e w h i c h g i v e s t h e E F R :
resize_A = imresize(A, [152 152]); % T h e s a m e s i z e f o r a l l i m a g e s
resize_B = imresize(B, [152 152]); % I n t e r p o l a t i o n , or d o w n s a m p l i n g or s a m e
45 EFR_image = (resize_A) - (resize_B ); % T h e d i f f e r e n c e i m a g e
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% E F R i m a g e w e i g h t e d u s i n g t h e G r a d i e n t i m a g e :
% 1. E F R i m a g e t h r e s h o l d i n g by 3 s i g m a :
level = std(std(EFR_image ));
50 Triple_sigma = 3*level;
thresh_EFR = max(EFR_image ,Triple_sigma .*ones( s ize (EFR_image )));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 2. G r a d i e n t of E F R i m a g e
w= [-1 0 1;-2 0 2;-1 0 1];
55 wm = [-1 -2 -1;0 0 0;1 2 1];
s = imfilter (EFR_image ,w,'replicate ');
g = imfilter (EFR_image ,wm,'replicate ');
grad_EFR = sqrt(s.^2 + g.^2);
sum_grad_EFR = sum(sum(grad_EFR ));
60 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% 3. W e i g h t e d E F R :
87
weighted = thresh_EFR .* grad_EFR;
EFR_Gradient =[ EFR_Gradient sum(sum(weighted ))];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
65 % a l s o by u s i n g t h e t h r e s h _ E F R we w a n t to f i n d no of p i x e l s in t h e
% t h r e s h o l d i n g i m a g e of E F R
small= min(min(thresh_EFR )); % b i n a r y i m a g e
binary_thresh_EFR = thresh_EFR > small;
ON_pixels = find(binary_thresh_EFR == 1);
70 [m,n]= s ize (ON_pixels );
EFR_Area_3sigma =[ EFR_Area_3sigma m*n];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
EFR_Sum =[ EFR_Sum sum(sum(EFR_image ))];
EFR_AbsSum =[ EFR_AbsSum sum(sum(abs(EFR_image )))];
75 EFR_mean =[ EFR_mean mean(mean(EFR_image ))];
EFR_std = [EFR_std std(std(EFR_image ))];
EFR_median =[ EFR_median median(median(EFR_image ))];
EFR_min = [EFR_min min(min(EFR_image ))];
EFR_max =[ EFR_max max(max(EFR_image ))];
80 no_of_images =[ no_of_images x]; % n u m b e r of i m a g e s
end
EFR_features = [EFR_Sum; EFR_AbsSum; EFR_Gradient; EFR_Area_3sigma;...
EFR_mean; EFR_std; EFR_median; EFR_min; EFR_max ];
disp(['save at:',base_directory ,Data_directory ,'/','_EFRfeatures.mat'])
85 save([ base_directory ,Data_directory ,'/','_EFRfeatures.mat'],'EFR_features ');
end
88
A.5 Wavelet Analysis Code
clear a l l
close a l l
clc
base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
5 data_directory = dir(base_directory );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for p = 3: length(data_directory)
Data_directory = data_directory(p).name;
filenames = dir ([ base_directory ,Data_directory ,'/*. fits']);
10
waveletType_L1 =[]; waveletType_L2 =[]; waveletType_L3 =[]; waveletType_L4 =[];
waveletType_L5 =[];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% m a g n e t o g r a m i m a g e s l o o p :
15 for k = 1: length(filenames)
filename = filenames(k).name;
A = fitsread ([ base_directory ,Data_directory ,'/',filename],'raw');
i f A(end,1) <-3000
20 A (A==A(end,1))= NaN;
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% H e a d e r i n f o r m a t i o n : i g n o r e t h e i m a g e s w h i c h h a v e a r a d i u s ( d i s t a n c e
% f r o m AR c e n t e r to d i s k c e n t e r ) g r e a t e r t h a n 6 5 0 a r c s e c o n d s .
25 hdr = fitsinfo ([ base_directory ,Data_directory ,'/',filename ]);
hdr.PrimaryData.Keywords;
radius = sqrt(cell2mat(hdr.PrimaryData.Keywords (187 ,2))^2 +...
cell2mat(hdr.PrimaryData.Keywords (188 ,2))^2);
i f radius >650
30 A=[];
89
else
[Lo_D ,Hi_D] = wfilters('haar'); N = 5;
[c,s]= wavedec2(A,N,Lo_D ,Hi_D);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
35 % F i n d t h e t h r e e h i g h p a s s d e t a i l s f o r e a c h l e v e l f r o m 1 to 5
for i=1:N
[H,V,D]= detcoef2('all',c,s,i); % E x t r a c t t h e t h r e e i m a g e s of e a c h l e v e l
[a,b] = s ize (V);
add_image = sum(abs(H(:)))+ sum(abs(V(:)))+ sum(abs(D(:))); % E n e r g y v a l u e
40 energy(i) = (add_image /(a*b)); % N o r m a l i z e t h e e n e r g y
no_of_levels(i)= i;
end
waveletEnergy_L1 = [waveletEnergy_L1 energy (1 ,1)];
waveletEnergy_L2 = [waveletEnergy_L2 energy (1 ,2)];
45 waveletEnergy_L3 = [waveletEnergy_L3 energy (1 ,3)];
waveletEnergy_L4 = [waveletEnergy_L4 energy (1 ,4)];
waveletEnergy_L5 = [waveletEnergy_L5 energy (1 ,5)];
end
end
50 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Wavelet_features =[ waveletEnergy_L1; waveletEnergy_L2; waveletEnergy_L3;...
waveletEnergy_L4; waveletEnergy_L5 ];
disp(['saving ',base_directory ,Data_directory ,'/','_Waveletfeatures.mat']);
save([ base_directory ,Data_directory ,'/','_Waveletfeatures.mat'],...
55 'Wavelet_features ');end
90
A.6 Feature Selection Code
close a l l
clear a l l
clc
addpath '/home/amani/Documents/MATLAB/prtools '
5 base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
% L o a d i n g n a m e s of f e a t u r e s
load(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/'...
'Gradient_names.mat']);
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/NL_names.mat');
10 load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/FD_names.mat');
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/EFR_names.mat')
load(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/'...
'Wavelet_names.mat']);
featureNames =[ Gradient_features_names;NL_features_names;FD_features_names;...
15 EFR_Features_Names;Wavelet_features_names ];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% F e a t u r e S e l e c t i o n P a r t
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
N=500; % 5 0 0 f l a r e a n d 5 0 0 n o f l a r e A R s u s e d to b a l a n c e t h e d a t a s e t A
20 M=100; % R e p e a t e t h e f e a t u r e s e l e c t i o n p r o c e s s M t i m e s
all_subset =[];
for f= 1:M
ARs= dir(base_directory );
ARs = ARs(3:end);
25 x_train =[]; y_train =[];i=randperm(2001);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for k = 1:1000
AR = ARs(i(k)). name % i is s o m e r a n d o m f i l e
load([ base_directory ,AR,'/','_FDfeatures.mat']);
30 load([ base_directory ,AR,'/','_NLfeatures.mat']);
91
load([ base_directory ,AR,'/','_Gradientfeatures.mat']);
load([ base_directory ,AR,'/','_EFRfeatures.mat']);
load([ base_directory ,AR,'/','_Waveletfeatures.mat']);
% W o r k s p a c e : F e a t u r e s
35 Gradient_features=Gradient_features (: ,[1:end-1]);
NL_features=NL_features (:,[1:end-1]);
FD_feature=FD_feature (:,[1:end-1]);
Wavelet_features = Wavelet_features (:,[1:end-1]);
features =[ Gradient_features;NL_features;FD_feature;EFR_features;...
40 Wavelet_features ];
x_train = [x_train features ]; % F e a t u r e m a t r i x
load([ base_directory ,AR,'/','flare_labels_2h_0m.mat']);
load([ base_directory ,AR,'/','radius650.mat']);
s = find(1-radius650 );
45 flare_labels(s) = [];
flare_labels = flare_labels ([1:end-1] ,:);
y_train = [y_train; flare_labels ]; % l a b e l v e c t o r
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
50 x_train = x_train ';
% R e m o v e a n y N a N ∗ o b s e r v a t i o n s ∗
[O,Fnan] = find( isnan(x_train ));
O = unique(O);
x_train(O,:) = []; y_train(O) = [];
55 % N o r m a l i z e f e a t u r e c o l u m n s to be on [−1 ,1]
[X_train ,mx,mn]= normalize_feature_columns(x_train );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% S t a r t i n g t h e f e a t u r e s s e l e c t i o n p a r t by f i r s t l y b a l a n c i n g t h e d a t a :
Y0 = find(y_train ==0); i0 = randperm( length(Y0));
60 Y1 = find(y_train ==1); i1 = randperm( length(Y1));
X_train_new = X_train ([Y0(i0(1:N)); Y1(i1(1:N))] ,:);
92
y_train_new = y_train ([Y0(i0(1:N)); Y1(i1(1:N))]);
% C r e a t p r T o o l s d a t a s e t
A=dataset(double(X_train_new),y_train_new ,'featlab ',featureNames );
65 % F e a t u r e s e l e c t i o n f u n c t i o n w i t h f i s h e r c as a t y p e of c l a s s i f i e r
[W,R] = featselp(A,fisherc ,0);
% T h e n e w s u b s e t of t h e s e l e c t e d f e a t u r e s .
all_subset = [all_subset; cellstr(getlab(W))];
end
70 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% S a v e t h e r e s u l t o r d e r of f e a t u r e s at e a c h t i m e s c a l e
save(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/'...
'All_subset_results/All_subset_2h.mat','all_subset '])
% P l o t i n g h i s t o g r a m of t h e r e s u l t f e a t u r e s :
75 [setout , mm, nn] = unique(all_subset );
for i=1: length(setout)
n(i,1)=sum(nn==i);
end
[n,IX] = sort(n);
80 setout = setout(IX) % f e a t u r e ’ s n a m e s s o r t e d f r o m l e a s t f r e q u e n t y to m a x i m u m
bar(1: length(n),n); % p l o t n u m b e r of f e a t u r e s a n d t h e r e p e t e t i o n of e a c h o n e
93
A.7 Fisher Linear Discriminant Analysis (FLDA) Classi�cation Code
close a l l
clear a l l
clc
addpath '/home/amani/Documents/MATLAB/prtools '
5 base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% L o a d i n g n a m e s of f e a t u r e s
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
'Gradient_names.mat');
10 load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/NL_names.mat');
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/FD_names.mat');
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
'EFR_names.mat');
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
15 'Wavelet_names.mat');
features ={'GradientFeatures ';'NLFeatures ';'fractal_dimension ';'EFRFeatures ';...
'Waveletfeatures '};
ARs= dir(base_directory );
ARs = ARs(3:end);
20 x_train =[]; y_train =[];i=randperm(2001);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% T R A I N I N G P A R T
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for k = 1:1000
25 AR = ARs(i(k)). name % i is s o m e r a n d o m f i l e
load([ base_directory ,AR,'/','_FDfeatures.mat']);
load([ base_directory ,AR,'/','_NLfeatures.mat']);
load([ base_directory ,AR,'/','_Gradientfeatures.mat']);
load([ base_directory ,AR,'/','_EFRfeatures.mat']);
30 load([ base_directory ,AR,'/','_Waveletfeatures.mat']);
94
% W o r k s p a c e : a l l f e a t u r e s
Gradient_features=Gradient_features (: ,[1:end-1]);
NL_features=NL_features (:,[1:end-1]);
FD_feature=FD_feature (:,[1:end-1]);
35 Wavelet_features = Wavelet_features (:,[1:end-1]);
features =[ Gradient_features;NL_features;FD_feature;EFR_features;...
Wavelet_features ];
x_train = [x_train features ]; % F e a t u r e s m a t r i x
% w o r k s p a c e : l a b e l v e c t o r
40 load([ base_directory ,AR,'/','flare_labels_2h_0m.mat']);
load([ base_directory ,AR,'/','radius650.mat']);
s = find(1-radius650 );
flare_labels(s) = []; % R e m o v e a l l l a b e l s f o r w h i c h r a d i u s > 6 5 0
flare_labels = flare_labels ([1:end-1] ,:);
45 y_train = [y_train; flare_labels ]; % L a b e l v e c t o r f o r t r a i n i n g
end
x_train = x_train ';
% r e m o v e a n y N a N ∗ o b s e r v a t i o n s ∗
[O,Fnan] = find( isnan(x_train )); O = unique(O);
50 x_train(O ,:)=[]; y_train(O)=[];
% N o r m a l i z e f e a t u r e c o l u m n s to be on [−1 ,1]
[X_train ,mx,mn]= normalize_feature_columns(x_train );
save mx_mn mx mn
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
55 % T E S T I N G P A R T
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
x_test =[]; y_test =[];
for k = 1001:2000
AR = ARs(i(k)). name % i w i l l c h o o s e t h e r e s t f i l e s
60 load([ base_directory ,AR,'/','_FDfeatures.mat']);
load([ base_directory ,AR,'/','_NLfeatures.mat']);
95
load([ base_directory ,AR,'/','_Gradientfeatures.mat']);
load([ base_directory ,AR,'/','_EFRfeatures.mat']);
load([ base_directory ,AR,'/','_Waveletfeatures.mat']);
65 % W o r k s p a c e : a l l f e a t u r e s
Gradient_features=Gradient_features (: ,[1:end-1]);
NL_features=NL_features (:,[1:end-1]);
FD_feature=FD_feature (:,[1:end-1]);
Wavelet_features = Wavelet_features (:,[1:end-1]);
70 features =[ Gradient_features;NL_features;FD_feature;EFR_features;...
Wavelet_features ];
x_test =[ x_test features ];
% W o r k s p a c e : l a b e l v e c t o r
load([ base_directory ,AR,'/','flare_labels_2h_0m.mat']);
75 load([ base_directory ,AR,'/','radius650.mat']);
s = find(1-radius650 );
flare_labels(s) = []; % R e m o v e a l l l a b e l s f o r w h i c h r a d i u s > 6 5 0
flare_labels = flare_labels ([1:end-1] ,:);
y_test =[ y_test; flare_labels ]; % l a b e l v e c t o r f o r t e s t i n g
80 end
x_test = x_test ';
% R e m o v e a n y N a N ∗ o b s e r v a t i o n s ∗
[O,Fnan] = find( isnan(x_test ));
O = unique(O);
85 x_test(O ,:)=[]; y_test(O) = [];
% N o r m a l i z e f e a t u r e c o l u m n s to be on [−1 ,1]
[X_test ,mx,mn]= normalize_feature_columns(x_test );
save mx_mn mx mn
featureNames =[ Gradient_features_names;NL_features_names;FD_features_names;...
90 EFR_Features_Names;Wavelet_features_names ];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% U s i n g t h e h i s t o g r a m of t h e f e a t u r e s s e l e c t e d to c h o o s e f e a t u r e s s u b s e t a n d
96
% r e d u c e t h e X _ t r a i n a n d X _ t e s t s i z e s r e l a t e d to s e l e c t e d f e a t u r e s
load(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
95 'All_subset_results/All_subset_2h.mat']);
[setout , mm, nn] = unique(all_subset );
for i=1: length(setout)
n(i,1)=sum(nn==i);
end
100 [n,IX] = sort(n);
setout = setout(IX); % F e a t u r s s o r t e d f r o m l e a s t f r e q u e n t y to m a x i m u m
setout = setout (30:35 ,:); % s e l e c t o p t i m a l f e a t u r e s s u b s e t or a l l ( 1 : 3 5 )
[f,indx] = ismember(setout ,featureNames );
X_train= X_train(:,indx); X_test = X_test(:,indx);
105 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% F i s h e r L i n e a r D i s c r i m i n a n t A n a l y s i s ( F L D A ) C l a s s i f i c a t i o n
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% B u i l d A ( t r a i n ) a n d B ( t e s t ) d a t a s e t s :
A = dataset(double(X_train),y_train ,'featlab ',setout );
110 B = dataset(double(X_test),y_test ,'featlab ',setout );
classifiers = {'fisherc '} % C l a s s i f i e r t y p e
num_features = s ize (y_test ,2);
M = 10; % M−f o l d c r o s s v a l i d a t i o n
N = 100; % N t r a i n i n g e x a m p l e s p e r c l a s s
115 train_classes = classsizes(A);
test_classes = classsizes(B);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
E_cum =[]; F_cum =[]; E_test_cum =[]; F_test_cum =[]; Hss =[]; Tss =[];
all_TP =[]; all_TN =[]; all_FP =[]; all_FN =[];
120 for m = 1:M
Y0 = find(y_train ==0); i0 = randperm( length(Y0));
Y1 = find(y_train ==1); i1 = randperm( length(Y1));
A_subset = dataset(double(X_train ([Y0(i0(1:N)); Y1(i1(1:N))],:)),...
97
y_train ([Y0(i0(1:N)); Y1(i1(1:N))]));
125 W_class = eval([ classifiers{c},'(A_subset)']); % T r a i n c l a s s i f i e r
[E,F] = testc(A_subset*W_class ); % C o m p u t e e r r o r s on t r a i n d a t a
[E_test ,F_test] = testc(B*W_class ); % C o m p u t e e r r o r s on t e s t d a t a
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% C o n f u s i o n m a t r i x a n d S k i l l s c o r e H S S a n d T S S
130 tot0 = s ize ( find(y_test ==0) ,1); tot1 = s ize ( find(y_test ==1) ,1);
TP = tot1 - F_test (2); all_TP =[ all_TP TP];
TN = tot0 - F_test (1); all_TN =[ all_TN TN];
FP = F_test (2); all_FP =[ all_FP FP];
FN = F_test (1); all_FN =[ all_FN FN];
135 [HSS ,TSS] = SkillScore(TP,FN,FP,TN); % C a l c u l a t e H S S a n d T S S
Hss=[Hss; HSS]; Tss=[Tss; TSS];
E_cum = [E_cum ; E]; F_cum = [F_cum ; F];
E_test_cum =[ E_test_cum;E_test ]; F_test_cum =[ F_test_cum;F_test ];
end
140 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% D i s p l a y t h e c l a s s i f i c a t i o n r e s u l t s
disp(['Classifier: ',classifiers{c}]);
disp('Training accuracies:');
disp(['Average accuracy: ',num2str(1-mean(E_cum ))]);
145 disp(['Class accuracies: ',num2str(1-mean(F_cum ,1)./N)]);
disp('Test accuracies:');
disp(['Average accuracy: ',num2str(1-mean(E_test_cum ))]);
disp(['Class accuracies: ',num2str(1-mean(F_test_cum ,1)./ test_classes )]);
disp('Skill Score : HSS /\ TSS ');
150 disp(['Average values: ',num2str(mean(Hss)), ' /\ ', num2str(mean(Tss ))]);
98
A.8 Relevance Vector Machine (RVM) Classi�cation Code
close a l l
clear a l l
clc
addpath '/home/amani/Documents/MATLAB/RVMtoolbox ';
5 addpath '/home/amani/Documents/MATLAB/stprtool ';
stprpath('/home/amani// Documents/MATLAB/stprtool ')
% L o a d i n g n a m e s of f e a t u r e s
load(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
'Gradient_names.mat']);
10 load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/NL_names.mat');
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/FD_names.mat');
load('/home/amani/Documents/MATLAB/Amani_Work/classification_codes/EFR_names.mat')
load(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
'Wavelet_names.mat']);
15 featureNames =[ Gradient_features_names;NL_features_names;FD_features_names;...
EFR_Features_Names;Wavelet_features_names ];
base_directory = '/home/amani/Desktop/Amani/master thesis/active region/';
ARs= dir(base_directory );
ARs = ARs(3:end);
20 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% T R A I N I N G P A R T : F e a t u r e M a t r i x ( X _ t r a i n ) a n d l a b e l v e c t o r ( y _ t r a i n )
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
x_train =[]; y_train1 =[];i=randperm(2001);
for k = 1:1000
25 AR = ARs(i(k)). name % i is s o m e r a n d o m f i l e
load([ base_directory ,AR,'/','_FDfeatures.mat']);
load([ base_directory ,AR,'/','_NLfeatures.mat']);
load([ base_directory ,AR,'/','_Gradientfeatures.mat']);
load([ base_directory ,AR,'/','_EFRfeatures.mat']);
30 load([ base_directory ,AR,'/','_Waveletfeatures.mat']);
99
% W o r k s p a c e : a l l f e a t u r e s
Gradient_features = Gradient_features (:,[1:end-1]);
NL_features = NL_features (:,[1:end-1]);
FD_feature = FD_feature (: ,[1:end-1]);
35 Wavelet_features = Wavelet_features (:,[1:end-1]);
features = [Gradient_features;NL_features;FD_feature;EFR_features;...
Wavelet_features ];
x_train = [x_train features ];
% W o r k s p a c e : l a b e l v e c t o r
40 load([ base_directory ,AR,'/','flare_labels_2h_0m.mat']);
load([ base_directory ,AR,'/','radius650.mat']);
s = find(1-radius650 );
flare_labels(s) = []; % R e m o v e a l l l a b e l s f o r w h i c h r a d i u s > 6 5 0
flare_labels = flare_labels ([1:end-1] ,:);
45 y_train1 = [y_train1;flare_labels ]; % L a b e l v e c t o r f o r t r a i n i n g
end
x_train = double(x_train ');
% R e m o v e a n y N a N ∗ o b s e r v a t i o n s ∗
[O,Fnan] = find( isnan(x_train ));
50 O = unique(O);
x_train(O,:) = []; y_train1(O) = [];
[X_train1 ,mx,mn] = normalize_feature_columns(x_train );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% T E S T I N G P A R T : F e a t u r e M a t r i x ( X _ t e s t ) a n d l a b e l v e c t o r ( y _ t e s t )
55 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
x_test =[]; y_test1 =[];
for k = 1001:2000
AR = ARs(i(k)). name % c h o o s e t h e r e s t f i l e s
load([ base_directory ,AR,'/','_FDfeatures.mat']);
60 load([ base_directory ,AR,'/','_NLfeatures.mat']);
load([ base_directory ,AR,'/','_Gradientfeatures.mat']);
100
load([ base_directory ,AR,'/','_EFRfeatures.mat']);
load([ base_directory ,AR,'/','_Waveletfeatures.mat']);
% W o r k s p a c e : f e a t u r e s
65 Gradient_features = Gradient_features (:,[1:end-1]);
NL_features = NL_features (:,[1:end-1]);
FD_feature = FD_feature (: ,[1:end-1]);
Wavelet_features = Wavelet_features (:,[1:end-1]);
features =[ Gradient_features;NL_features;FD_feature;EFR_features;...
70 Wavelet_features ];
x_test =[ x_test features ];
% W o r k s p a c e : l a b e l v e c t o r
load([ base_directory ,AR,'/','flare_labels_2h_0m.mat']);
load([ base_directory ,AR,'/','radius650.mat']);
75 s = find(1-radius650 );
flare_labels(s) = [];
flare_labels = flare_labels ([1:end-1] ,:);
y_test1 =[ y_test1; flare_labels ]; % L a b e l v e c t o r f o r t e s t i n g
end
80 x_test = x_test ';
% R e m o v e a n y N a N ∗ o b s e r v a t i o n s ∗
[O,Fnan] = find( isnan(x_test ));
O = unique(O);
x_test(O,:) = [];
85 y_test1(O) = [];
[X_test1 ,mx,mn]= normalize_feature_columns(x_test );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% U s i n g t h e h i s t o g r a m of t h e f e a t u r e s to c h o o s e f e a t u r e s s u b s e t a n d
% r e d u c e t h e X _ t r a i n a n d X _ t e s t s i z e s r e l a t e d to s e l e c t e d f e a t u r e s
90 load(['/home/amani/Documents/MATLAB/Amani_Work/classification_codes/',...
'All_subset_results/All_subset_2h.mat']);
[setout , mm, nn] = unique(all_subset );
101
for i=1: length(setout)
ni(i,1)=sum(nn==i);
95 end
[ni ,IX] = sort(ni);
setout = setout(IX); % F e a t u r e s s o r t e d f r o m l e a s t f r e q u e n t y to m a x i m u m
setout = setout (33:35 ,:); % S e l e c t o p t i m a l f e a t u r e s u b s e t or a l l ( 1 : 3 5 )
[f,indx] = ismember(setout ,featureNames );
100 X_train1= X_train1(:,indx);
X_test1 = X_test1(:,indx);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% R V M c l a s s i f i c a t i o n m e t h o d
% G a u s s i a n K e r n e l −b a s e d b i n a r y c l a s s i f i e r
105 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
M=10; % M−f o l d c r o s s v a l i d a t i o n
N=400; % N t r a i n i n g e x a m p l e s p e r c l a s s
true_positive_rate =[]; true_negative_rate =[]; Tss =[]; Hss =[];
all_TP =[]; all_TN =[]; all_FP =[]; all_FN =[];
110 for m =1:M
Y0 = find(y_train1 ==0); i0 = randperm( length(Y0));
Y1 = find(y_train1 ==1); i1 = randperm( length(Y1));
X_train_new = X_train1 ([Y0(i0(1:N)); Y1(i1(1:N))] ,:);
y_train_new = y_train1 ([Y0(i0(1:N)); Y1(i1(1:N))]);
115 K=[];
for n=1: s ize (X_train_new ,1)
v=[];
for j=1: s ize (X_train_new ,1)
v = [v exp(( -1/0.22)*((norm(X_train_new(n,:)- X_train_new(j ,:)))^2))];
120 end
K=[K; v]; % G a u s s i a n k e r n e l b a s e d b i n a r y c l a s s i f i e r
end
[parameter ,hyperparameter , diagnostic ]= SparseBayes('Bernoulli ',K,y_train_new );
102
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
125 a = parameter.Value;
index = parameter.Relevant;
X_relev = [X_train_new(index ,:)];
K_test =[];
for p=1: s ize (index ,1)
130 v2=[];
for s=1: s ize (X_test1 ,1)
v2=[v2 exp(( -1/0.22)*((norm(X_relev(p,:) - X_test1(s ,:)))^2))];
end
K_test =[ K_test; v2];
135 end
Y = K_test '*a; % R e s u l t v e c t o r Y f o u n d u s i n g t h e m o d e l ( a ) f r o m t h e t r a i n i n g p a r t
v1= find(Y >0.5); result(v1)=1;
v0= find(Y <=0.5); result(v0)=0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
140 % C o n f u s i o n m a t r i x a n d S k i l l s c o r e H S S a n d T S S
tot0= s ize ( find(y_test1 ==0) ,1); tot1 = s ize ( find(y_test1 ==1) ,1);
g0 = y_test1( find(result ==0)); TN = s ize ( find(g0==0) ,1); all_TN =[ all_TN TN];
g1 = y_test1( find(result ==1)); TP = s ize ( find(g1==1) ,1); all_TP = [all_TP TP];
g2 = result( find(y_test1 ==0)); FN = tot0 -TN; all_FN =[ all_FN FN];
145 g3 = result( find(y_test1 ==1)); FP = tot1 -TP; all_FP =[ all_FP FP];
[HSS ,TSS] = SkillScore(TP,FN ,FP,TN); % C a l c u l a t e H S S a n d T S S
Hss=[Hss; HSS]; Tss=[Tss; TSS];
false_negatives_rate = cerror(result ',y_test1 ,0);
false_positives_rate = cerror(result ',y_test1 ,1);
150 true_positive_rate = [true_positive_rate; 1-false_positives_rate ];
true_negative_rate = [true_negative_rate; 1-false_negatives_rate ];
end
[h,Fhnan] = find( isnan(Tss));
h = unique(h); Tss(h,:) = []; Hss(h ,:)=[];
103
155 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% D i s p l a y t h e c l a s s i f i c a t i o n r e s u l t s
disp('Test accuracies: No Flare (TN_rate) /\ Flare (TP_rate) ');
disp(['Class accuracies(rate):',num2str(mean(true_negative_rate )),'/\',...
num2str(mean(true_positive_rate ))]);
160 disp(['Confusion matrix:TP:',num2str(mean(all_TP)),...
'/\ FN: ', num2str(mean(all_FN ))]);
disp([' FP:',num2str(mean(all_FP)),...
' /\ TN: ', num2str(mean(all_TN ))]);
disp('Skill Score : HSS /\ TSS ');
165 disp(['Average values: ',num2str(mean(Hss)), ' /\ ', num2str(mean(Tss ))]);
104
REFERENCES
[1] V. I. Abramenko. Multifractal analysis of solar magnetograms. Solar Physics,228:29�42, 2005.
[2] V. I. Abramenko, V. B. Yurchyshyn, H. Wang, T. J. Spirock, and P. R.Goode. Scaling behavior of structure functions of the longitudinal magnetic�eld in active regions on the sun. The Astrophysical Journal, 577:487�495,2002.
[3] V. I. Abramenko, V. B. Yurchyshyn, H. Wang, T. J. Spirock, and P. R.Goode. Signature of an avalanche in solar �ares as measured by photosphericmagnetic �elds. The Astrophysical Journal, 597:1135�1144, 2003.
[4] S. Antiochos, C. R. Devore, and J. A. Klimchuk. A Model for Solar CoronalMass Ejections. The Astrophysical Journal, 510:485�493, 1999.
[5] C. M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006.
[6] D. S. Bloom�eld, P. A. Hggins, R. T. James McAteer, and P. T. Gallagher.Solar �are forcasting: From probabilities to targeted prediction. Submittedto: The Astrophysical Journal.
[7] A. C. Cadavid, J. K. Lawrence, A. A. Ruzmaikin, and A. Kayleng-Knight.Multifractal models of small-scale solar magnetic �elds. The AstrophysicalJournal, 429:391�399, 1994.
[8] P. A. Conlon, P. T. Gallagher, R. T. J. McAteer, J. Ireland, C. A. Young,P. Kestener, R. J. Hewett, and K. Maguire. Multifractal properties of evolvingactive regions. Solar Physics, 248:297�309, 2008.
[9] Y. Cui, R. Li, L. Zhang, Y. He, and H. Wang. Correlation between solar�are productivity and photospheric magnetic �eld properties. Solar Physics,237:45�59, 2006.
[10] M. Dash and H. Liu. Feature selection for classi�cation. Intelligent DataAnalysis, 1:131�156, 1997.
[11] Van der Heijden, Robert P.W. Duin, Dick de Ridder, and David M.J. Tax.Classi�cation, parameter estimation and state estimation - an engineeringapproach using Matlab. Ferdi, 2004.
[12] J. W. Dungey. A family of solutions of the magneto-hydrostatic problem in aconducting atmosphere in a gravitational �eld. Monthly Notices of the RoyalAstronomical Society, 113:180�187, 1953.
105
[13] D. Falconer, A. F. Barghouty, I. Khazanov, and R. Moore. A tool for empiricalforecasting of major �ares, coronal mass ejections, and solar particle eventsfrom a proxy of active-region free magnetic energy. Space Weather, 9:1�12,2011.
[14] D. A. Falconer, R. L. Moore, and G. A. Gary. A measure from line-of-sightmagnetograms for prediction of coronal mass ejections. Journal of Geophys-ical Research, 108, 2003.
[15] D. A. Falconer, R. L. Moore, and G. A. Gary. Magnetic causes of solar coronalmass ejections: Dominance of the free magnetic energy over the magnetictwist alone. The Astrophysical Journal, 644:1258�1272, 2006.
[16] D. A. Falconer, R. L. Moore, and G. A. Gary. Magnetogram measures oftotal nonpotentiality for prediction of solar coronal mass ejections from activeregions of any degree of magnetic complexity. The Astrophysical Journal,689:1433�1442, 2008.
[17] J. Feynman and S. F. Martin. The initiation of coronal mass ejections bynewly emerging magnetic �ux. Geophysics, 100:3355�3367, 1995.
[18] R. A. Fisher. The use of multiple measurements in taxonomic problems.Annals of Eugenics, 7:179�188, 1936.
[19] P. T. Gallagher, Y.-J. Moon, and H. Wang. Active-region monitoring and�are forecasting. Solar Physics, 209:171�183, 2002.
[20] M. K. Georgoulis and D. M. Rust. Quantitative forecasting of major solar�ares. The Astrophysical Journal, 661:L109�L112, 2007.
[21] R. C. Gonsalez and R. E. Woods. Digital image procssing. Gatesmark Pub-lishing, 2008.
[22] R. C. Gonsalez, R. E. Woods, and S. L. Eddins. Digital Image ProcssingUsing Matlab. Gatesmark Publishing, 2009.
[23] L. M. Green, P. Demoulin, C. H. Mandrini, and L. van Driel-Gesztelyi. Howare emerging �ux, �ares and CMEs related to the magnetic polarity imbalancein MDI data? Solar Physics, 215:307�329, 2003.
[24] J. Guo, H. Zhang, O. V. Chumak, and Y. Liu. A quantititative study onmagnetic con�gurations for active regions. Solar Physics, 237:25�43, 2006.
[25] M. J. Hagyard, B. A. Stark, and P. Venkatakrishnan. A search for vectormagnetic �eld variations associated with the M-class �ares of 10 June 1991in AR 6659. Solar Physics, 184:133�147, 1999.
106
[26] R. J. Hewett, P. T. Gallagher, R. T. J. McAteer, C. A. Young, J. Ireland,P. A. Conlon, and K. Maguire. Multiscale analysis of active region evolution.Solar Physics, 248:311�322, 2008.
[27] J. Heyvaerts, E. R. Priest, and D. M. Rust. An emerging �ux model for thesolar �are phenomenon. Astrophys Journal, 216:123�137, 1977.
[28] X. Huang, D. Yu, Q. Hu, H. Wang, and Y. Cui. Short-term solar �areprediction using predictor teams. Solar Physics, 263:175�184, 2010.
[29] J. Ireland, C. A. Young, R. T. J. McAteer, C. Whelan, R. J. Hewett, and P. T.Gallagher. Multiresolution Analysis of Active Region Magnetic Structure andits Correlation with the Mount Wilson Classi�cation and Flaring Activity.Solar Physics, 252:121�137, 2008.
[30] H. Isobe, T. Miyagoshi, K. Shibata, T. Yokoyama, and R. Matsumoto. Mag-netohydrodynamic simulation of emerging �ux region of the sun. Journal ofthe Earth Simulator, 7:3�8, 2007.
[31] A. Jain and D. Zongker. Feature selection: Evaluation, application, and smallsample performance. IEEE Transactions on Pattern Analysis and MachineIntelligence, 19, 1997.
[32] J. Jing, H. Song, V. Abramenko, C. Tan, and H. Wang. The statistical re-lationship between the photospheric magnetic parameters and the �are pro-ductivity of active regions. The Astrophysical Journal, 644:1273�1277, 2006.
[33] Kenneth R. Lang. Sun, Earth and Sky. Springer, 1995.
[34] J. K. Lawrence. Di�usion of magnetic �ux elements on a fractal geometry.Solar Physics, 135:249�259, 1991.
[35] J. K. Lawrence, A. C. Cadavid, and A. A. Ruzmaikin. On the MultifractalDistribution of Solar Magnetic Fields. The Astrophysical Journal, 465:425�435, 1996.
[36] J. K. Lawrence, A. A. Ruzmaikin, and A. C. Cadavid. Multifractal Measureof the Solar Magnetic Field. The Astrophysical Journal, 417:805�811, 1993.
[37] K. D. Leka and G. Barnes. Photospheric magnetic �eld properties of �ar-ing versus �are-quiet active regions. I. Data, general approach, and sampleresults. The Astrophyiscal Journal, 595:1277�1295, 2003.
[38] K. D. Leka and G. Barnes. Photospheric magnetic �eld properties of �aringversus �are-quiet active regions. II. Discriminant analysis. The AstrophysicalJournal, 595:1296�1306, 2003.
107
[39] K. D. Leka and G. Barnes. Photospheric magnetic �eld properties of �aringversus �are-quiet active regions. IV. A statistically signi�cant sample. TheAstrophysical Journal, 656:1173�1186, 2007.
[40] H. Liu and L. Yu. Toward integrating feature selection algorithms for clas-si�cation and clustering. IEEE Transactions on Knowledge and Data Engi-neering, 17:491�502, 2005.
[41] B. Mandelbrot and R. L. Hudson. The (Mis) Behavier of Market, A fractalview of risk. Basic Books, 2004.
[42] P. Maragos. Measuring the fractal dimension of signals: Morphological coversand iterative optimization. IEEE Transaction on Signal Processing, 41:108�121, 1993.
[43] J. P. Mason and J. T. Hoeksema. Testing automated solar �are forecastingwith 13 years of Michelson Doppler Imager magnetograms. The AstrophysicalJournal, 723:634�640, 2010.
[44] R. T. J. McAteer, P. T. Gallagher, and J. Ireland. Statistics of active re-gion complexity: A large scale fractal dimension survey. The AstrophysicalJournal, 631:628�635, 2005.
[45] N. Meunier. Complexity of magnetic structures: Flares and cycle phasedependence. Astronomy and Astrophysics, 420:333�342, 2004.
[46] R. L. Moore, A. Sterling, H. S. Hudson, and J. R. Lemen. Onset of the mag-netic explosion in solar �ares and coronal mass ejections. The AstrophysicalJournal, 552:833�848, 2001.
[47] NASA. Layers of the sun. http://www.spacestationinfo.com/layers-sun.htm,2012.
[48] E. N. Parker. Kinematical hydromagnetic theory and its application to thelow solar photosphere. The Astrophysical Journal, 138:552�575, 1963.
[49] S. R. Patty and M. J. Hagyard. Delta-con�gurations - Flare activity andmagnetic-�eld structure. Solar Physics, 103:111�128, 1986.
[50] C. D. Prasad. Characteristics of �aring sites in solar active regions. Astro-physics and Space Science journal, 274:463�471, 2000.
[51] E. R. Priest and T. G. Forbes. Magnetic �eld evolution during prominenceeruptions and two-ribbon �ares. Solar Physics, 126:319�350, 1990.
108
[52] P. Pudil, J. Novovicova, and J. Kittler. Floating search methods in featureselection. Pattern Recognition Letters, 15:1119�1125, 1994.
[53] K. Rodenacker and E. Bengtsson. A feature set for cytometry on digitizedmicroscopic images. Analytical Cellular Pathology, 25, 2003.
[54] G. Roumeliotis and R. L. Moore. A linear solution for magnetic reconnectiondriven by converging or diverging �ows. The Astrophysical Journal, 416:386�391, 1993.
[55] C. J. Schrijver. A characteristic magnetic �eld pattern associated with allmajor solar �ares and its use in �are forecasting. The Astrophysical Journal,655:L117�L120, 2007.
[56] C. J. Schrijver, C. Zwaan, A. C. Balke, T. D.Tarbell, and J. K. Lawrence.Patterns in the photospheric magnetic �eld and percolation theory. Astron-omy & Astrophysics, 253:L1�L4, 1992.
[57] P. E. Seiden and D. G. Wentzel. Solar active regions as a percolation phe-nomenon.II. The Astrophysical Journal, 460:522, 1996.
[58] P. H. Sherrer, R. S. Bogart, R. I. Bush, J. T. Hoeksema, and A. G. Koso-vichev. The Solar Oscillations Investigation-Michelson Doppler Imager. SolarPhysics, 162:129�188, 1995.
[59] H. Song, C. Tan, J. Jing, H. Wang, V. Yurchyshyn, and V. Abramenko.Statistical assessment of photospheric magnetic features in imminent solar�are predictions. Solar Physics, 254:101�125, 2009.
[60] J. O. Sten�o. Small-scale magnetic structures on the sun. Astronomy &Astrophysics Review, 1:3�48, 1989.
[61] F. Tang and H. Wang. On the dynamic activity in sheared corridors of largedelta spots. Solar Physics, 143:107�118, 1993.
[62] L. Tao, Y. Du, R. Rosner, and F. Cattaneo. On the spatial distribution ofmagnetic �elds on the solar surface. The Astrophysical Journal, 443:434�443,1995.
[63] M. E. Tipping. Sparse Bayesian learning and the relevance vector machine.Journal of Machine Learning Research, 1:211�244, 2001.
[64] L. Vlahos, T. Fragos, H. Isliker, and M. Georgoulis. Statistical properties ofthe energy release in emerging and evolving active regions. The AstrophysicalJournal, 575:87�90, 2002.
109
[65] H. Wang. Rapid changes of photospheric magnetic �elds around �aring mag-netic �eld lines. The Astrophysical Journal, 649:490�497, 2006.
[66] NOAA/National Weather Service. Space Weather Prediction Center website.http://www.swpc.noaa.gov/, 2007.
[67] D. G. Wentzel and P. E. Seiden. Solar active regions as a percolation phe-nomenon. The Astrophysical Journal, 390:280�289, 1992.
[68] F. Woodcock. The evaluation of yes/no forecasts for scienti�c and adminis-trative purposes. Monthly Weather Review, 104:1209�1214, 1946.
[69] D. Yu, X. Huang, Q. Hu, R. Zhou, H. Wang, and Y. Cui. Short-term solar�are prediction using multiresolution predictors. The Astrophysical Journal,709:321�326, 2010.
[70] D. Yu, X. Huang, H. Wang, and Y. Cui. Short-term solar �are predictionusing a sequential supervised learning method. Solar Physics, 255:91�105,2009.
[71] D. Yu, X. Huang, H. Wang, Y. Cui, Q. Hu, and R. Zhou. Short-Term SolarFlare Level Prediction Using a Bayesian Network Approach. The Astrophys-ical Journal, 710:869�877, 2010.
[72] Y. Yuan, F. Y. Shih, J. Jing, and H.-M. Wang. Automated �are forecastingusing a statistical learning technique. Research in Astronomy and Astro-physics, 10:785�796, 2010.
[73] H. Zhang. Electric current and magnetic shear in solar active regions. TheAstrophysical Journal, 557:71�74, 2001.
[74] H. Zhang, G. Ai, X. Yan, W. Li, and Y. Liu. Evolution of vector magnetic�eld and white-light �ares in a solar active region (NOAA 6659) in 1991 June.The Astrophysical Journal, 423:828�846, 1994.
110