scieee Science in your language
[en] (orig)

Online forecasting using neighbor-based incremental learning for electricity markets

Author: Melgar-García, L.; Gutiérrez Avilés, David; Rubio Escudero, Cristina; Troncoso, A.
Publisher: Springer
Year: 2025
DOI: 10.1007/s00521-024-10876-x
Source: https://idus.us.es/bitstreams/4d5772e4-87bb-4173-92be-e920b0e6819c/download
S.I.: INCREMENTAL LEARNING
Online o ecas ing using neighbo -based inc emen al lea ning
o elec ici y ma ke s
L. Melga -Ga cı
´a
1
•D. Gu ie
´ ez-A ile
´s
2
•C. Rubio-Escude o
2
•A. T oncoso
3
Recei ed: 3 Oc obe 2023 / Accep ed: 2 Decembe 2024
The Au ho (s) 2025
Abs ac
Elec ici y ma ke o ecas ing is e y use ul o he di e en ac o s in ol ed in he ene gy sec o o plan bo h he supply
chain and ma ke ope a ion. Nowadays, ene gy demand da a a e da a coming om sma me e s and ha e o be p ocessed
in eal- ime o mo e e icien demand managemen . In addi ion, elec ici y p ices da a can p esen changes o e ime such
as new pa e ns and new ends. The e o e, eal- ime o ecas ing algo i hms o bo h demand and p ices ha e o adap and
adjus o online da a in o de o p o ide imely and accu a e esponses. This wo k p esen s a new algo i hm o elec ici y
demand and p ices o ecas ing in eal- ime. The p oposed algo i hm gene a es a p edic ion model based on he k-nea es
neighbo s algo i hm, which is inc emen ally upda ed in an online scena io conside ing bo h changes o exis ing pa e ns
and adding new de ec ed pa e ns o he model. Bo h ime- equency and e o h eshold based model upda es ha e been
e alua ed. Resul s using ene gy demand om 2007 o 2016 and p ices da a o di e en ime pe iods om he Spanish
elec ici y ma ke a e epo ed and compa ed wi h o he benchma k algo i hms.
Keywo ds Real- ime o ecas ing Inc emen al lea ning S eaming ime se ies Elec ici y
1 In oduc ion
Nowadays, he opic o ime se ies o ecas ing is ecei ing
inc easing a en ion, especially because o i s in e disci-
plina y na u e. Almos all scien i ic disciplines consis o
da a sampled o e ime, which makes o ecas ing a ask o
u mos impo ance and complexi y.
Big da a s eaming is becoming one o mos widely used
ends in big da a in ecen yea s. The mos impo an
ea u e o big da a s eaming is he eloci y e e ed o
la ge con inuous lows o da a, called s eams. Algo i hms
dealing wi h big da a s eaming aim o yield esul s in eal-
ime. Fo his eason, s eams need o be p ocessed and
modeled in a special way conside ing speci ic equi emen s
[1]. In addi ion o ob aining as esul s when wo king in
s eaming mode, i is impo an o de elop a model ha
mus be always eady o gi e esponses. Howe e ,
s eaming lows usually a ia e and su e ans o ma ions
which could lead o a non-accu a e esponse i he model
does no adap o hem [2]. Thus, p edic ion models o
s eaming da a mus be upda ed as he da a a i es in eal-
ime o bes ma ch i s new beha io . This upda e mus be in
eal- ime, so he e- aining o he model should be dis-
ca ded in a o o inc emen al lea ning.
Pa icipan s in elec ici y ma ke s (bo h demand and
p ices) a e pa icula ly in e es ed in o ecas ing, as
ob aining o ecas s is c i ical o many a eas in o de o
inc ease p o i s o educe cos s. In addi ion, clima e change
is one o he mos conce ning opics o ecen decades.
Clima e change has led o he g ow h o enewable ene gies
&L. Melga -Ga cı
´a
[email p o ec ed]
D. Gu ie
´ ez-A ile
´s
[email p o ec ed]
C. Rubio-Escude o
[email p o ec ed]
A. T oncoso
[email p o ec ed]
1
Depa men o A i icial In elligence, Uni e sidad Poli e
´cnica
de Mad id, 28660 Mad id, Spain
2
Depa men o Compu e Science, Uni e si y o Se ille,
A da. Reina Me cedes s/n, 41012 Se ille, Spain
3
Da a Science and Big Da a Lab, Pablo de Ola ide Uni e si y,
41013 Se ille, Spain
123
Neu al Compu ing and Applica ions
h ps://doi.o g/10.1007/s00521-024-10876-x(0123456789().,- olV)(0123456789().,- olV)
in many coun ies in ecen yea s. Due o he ola ili y and
in e mi ency o he enewable ene gies, he powe g id
cu en ly p esen s eno mous unce ain y and elec ici y
ma ke s p esen changes and luc ua ions. These changes
can lead o shi s in exis ing pa e ns in he da a, he
eme gence o new pa e ns o e en anomalous beha io .
The e o e, o ecas ing elec ici y p ices in an online sce-
na io becomes essen ial. In his con ex , he cu en p o-
g ess o In e ne o Things (IoT) de ices is leading o he
possibili y o moni o ing ene gy consump ion. Fu he -
mo e, IoT de ices p o ide ex ensi e amoun s o high-di-
mensional da a in s eaming [3]. This ype o da a opens up
a huge ield o s udy in he big da a s eaming pa adigm
wi h he aim o ob aining eal- ime solu ions ha lead o
ene ge ic e iciency.
In his wo k, we p opose an algo i hm o p edic elec-
ici y demand and p ices ime se ies in eal- ime. This
algo i hm, named S eamWNN, uses he K-nea es neigh-
bo s o compu e he inal p edic ion and he neighbo s a e
upda ed o e ime h ough inc emen al lea ning. In pa -
icula , he S eamWNN algo i hm is made up o wo
phases: a ba ch phase in which a his o ical model based on
nea es neighbo s is c ea ed and an online phase o o ecas
and upda e he model. The e o e, he online phase keeps
he model always adjus ed o he cu en da a also adding in
he model new pa e ns called no el ies and de ec ing
possible anomalies. Resul s using ene gy consump ion da a
in Spain om 2007 o 2016 and elec ici y p ices da a o
h ee di e en ime pe iods a e e alua ed o show he
accu acy o he p edic ions, he esponse ime o he
algo i hm and he imp o emen s ob ained when he model
is upda ed. The aim o his esea ch pape is o show how
he p oposed inc emen al lea ning o he nea es neighbo
me hod imp o es he online p edic ions.
The es o he pape is s uc u ed as ollows. Sec ion 2
p esen s a e iew o o ecas ing algo i hms o ene gy ime
se ies ocusing on eal- ime and da a ecei ed in s eaming.
In Sec . 3, he me hodology o he S eamWNN algo i hm
is desc ibed, including how he upda ing o he p edic ion
model is pe o med. Sec ion 4de ines he elec ici y
demand and p ices da ase s used and p esen s he discus-
sion o he esul s. The pape ends wi h some inal con-
clusions and ideas o u u e app oaches in Sec . 5.
2 Rela ed wo k
Time se ies o ecas ing has been ex ensi ely s udied o
sol e nume ous p oblems in di e en ields, wi h a wide
ange o applica ions. Fo example, p edic ing elecom-
munica ions ne wo k a ic as a ime se ies is use ul o
assigning esou ces acco ding o demand, op imizing
ou ing, de ec ing anomalies o designing, moni o ing and
managing he ne wo k [4]. In [5], his p oblem was sol ed
using a combina ion o CNN-LSTM neu al ne wo ks a e
p o ing ha classical me hods such as ARIMA and SVR
we e no able o co ec ly p edic hese complex ime se ies
pa e ns. In [6], his ime se ies p edic ion p oblem was
sol ed using he hyb id CNN-LSTM model oge he wi h a
ea u e selec ion module and a hype pa ame e sea ch
op imiza ion module.
Mos o he published p edic ion models o big da a
ime se ies wo k in ba ch mode. The e is s ill a lo o
esea ch o do in ela ion o s eaming en i onmen s. The
challenges o high-dimensional massi e da a mining in
eal- ime a e ela ed o s o age, p ocessing and ob aining
use ul knowledge. Unde s anding and analyzing da a in
s eaming is necessa y o assis in he decision-making
p ocess [7]. Thanks o he inc easing amoun o massi e
da a om elec onic de ices, he e a e lo s o applica ions
o his ype o da a. In e ms o s eaming ime se ies
o ecas ing, au ho s in [8] p esen ed se e al models o
p edic he e olu ion o he COVID-19 pandemic in eal-
ime. In [9] a o ecas ing model o s eaming axi demand
was p esen ed. O he ypes o algo i hms a e s a ing o
ha e mo e in luence in s eaming en i onmen s. A i-
clus e ing algo i hm [10] was de eloped o he eal- ime
p ocessing in [11,12]. Th ee-dimensional pa e ns om
en i onmen al senso and medical s eaming da a we e
ob ained.
In he eal- ime en i onmen , a e iew o o ecas ing
algo i hms o s eaming da a om yea 2000 o 2015 was
p esen ed in [13]. In [14] a new algo i hm o s eaming
ene gy demand da a o ecas ing was p oposed. I used h ee
di e en algo i hms adap ed o s eaming da a: k-means,
nea es neighbo s and Nai e Bayes. In [15] a andomized
e sion o neu al ne wo k wi h a inc emen al lea ning
using he elec ic load da ase s om Aus alian ene gy
ma ke was p oposed o imp o e bo h e iciency and
accu acy. In [16] a o ecas ing online sel -adap i e model
based on andom o es was applied o elec ici y ma ke
p ice. Au ho s demons a ed ha his online model, ha
ook in o conside a ion he luc ua ions and ola ili y o
p ice, was mo e accu a e han he benchma k algo i hms in
he li e a u e. In [17] a XGBoos was de eloped o eal-
ime p ice o ecas in Singapo e.
Simila ly, elec ici y demand o ecas ing ha e been
s udied mos ly in he ba ch o adi ional mode. Rega ding
he adi ional app oach, au ho s in [18] p esen ed a big
da a app oach o elec ici y consump ion in sma ci ies.
P edic ions o elec ici y demand using nea es neighbo s
om Apache Spa k amewo k o big da a we e made in
[19]. Rega ding elec ici y p ice o ecas ing, a e iew o
cu en elec ici y p ice o ecas ing me hods was p esen ed
in [20]. In [21] a mul i a ia e logis ic eg ession model was
used o o ecas day-ahead ex emely low and high
Neu al Compu ing and Applica ions
123
Aus alian elec ici y p ices, aking in o accoun in luenc-
ing a iables. Au ho s ocused on unde s anding he
dynamics o ex eme elec ici y p ices. A o ecas ing
algo i hm based on gene ic op imiza ion o No dic elec-
ici y spo p ice da a was de eloped in [22]. A LSTM
model was deployed o o ecas he a e age mon hly spo
p ices in Spain in [23].
Conce ning s eaming modeling, his ype o da a can
a ia e and change i s beha io al pa e ns while ime pas-
ses. I is impo an o ha e a s eaming model ha adap s o
he new s eams o da a.
Many o he app oaches in he li e a u e o model
upda ing in s eaming en i onmen a e based on ex e nal
algo i hms as he Kalman il e . Au ho s in [24] p esen ed a
coupled me hodology o he K-nea es neighbo algo i hm
wi h a Kalman il e o eal- ime lood o ecas ing. The
s a e ansi ion ma ix o he Kalman il e was ecalcula ed
using he o ecas ing me hod o imp o e he pe o mance
o he model and ob ain accu a e esul s. In [25] concep s
o ensemble Kalman il e we e used o upda e a ain all
uno model o o ecas ing la ge loods in eal- ime.
Ano he ensemble Kalman il e was also used in [26]. The
ensemble was used as a da a assimila ion algo i hm o
upda e wa e empe a u e o ecas ing conside ing senso
ins ances.
Recen ly, deep neu al ne wo ks ha e been used o p e-
dic s eaming da a by aking in o accoun he changes ha
he da a may unde go o e ime. A wa ele -neu al ne wo k
wi h an e o -upda ing scheme was p oposed in [27] o
me eo ological p edic ions in s eaming. The need o sys-
ema ic e o -upda ing o s eam lows was p o en.
Au ho s in [28] p oposed an inc emen al upda e me hod
based on suppo ec o machine (SVM) and ga e ecu en
uni (GRU) conside ing concep d i o o ecas ing in
eal- ime. T aining models we e upda ed based on he e o
be ween ba ch es esul s and eal alues. In [29] a com-
bina ion o a eal- ime au o eg ession and a deep Long
Sho -Te m Memo y (LSTM) ecu en ne wo k o p edic
s eaming da a om indus ial p ocesses was p oposed.
The deep LSTM ound empo al ela ionships in da a while
he au o eg ession model add essed o e lap and ans e
be ween di e en ecu ing concep s d i s hus imp o ing
he accu acy. The high ola ili y and noise cha ac e is ics
o elec ici y p ice pose g ea challenges in p edic ing i . In
[30] eal- ime elec ici y p ice o ecas ing was accu a ely
pe o med by applying ans e lea ning and GRU. How-
e e , he e is no e e ence o concep d i in he a icle.
The au ho s emphasized ha ans e lea ning models on
hyb id da ase s a e obus o changes in he inpu da a and
he e o e mo e gene alizable. In [31] and [32] wo new
me hods we e p esen ed o he same objec i e: eal- ime
o ecas ing o elec ici y p ice. The o me used a CNN-
GRU pa allel s a is ical model, while he la e employed a
CNN-based au oencode . The las model ob ained he mos
accu a e esul s. The de eloped models made igh p e-
dic ions aking in o accoun he high noise, ola ili y and
nonlinea i y o he da a.
3 Me hodology
The S eamWNN s eaming algo i hm [33] is based on he
K-nea es neighbo s [34] which main idea is ha nea es
da a sha e simila p ope ies o cha ac e is ics. This is
c ucial o he p oblem o be sol ed, i.e., ime se ies
o ecas ing wi h model upda e while ecei ing eal- ime
da a. Online model upda es and accu a e p edic ions a e
pe o med based on simila p ope ies o cha ac e is ics o
he pas da a and he newly ecei ed da a. This inc emen al
lea ning app oach o he machine lea ning algo i hm is key
o ob aining mo e accu a e esul s on da a wi h simila i ies
o e ime, as elec ici y ma ke s da a. In elec ici y ma -
ke s, bo h ene gy consump ion and ma ke p ices a e ime
se ies and hei p edic ion can be o malized wi h he
heo e ical p oblem desc ibed below.
The goal o his ime se ies o ecas ing p oblem is o
p edic he nex alues conside ing pas ones. The ime
se ies used is di ided in o Nins ances whe e he i- h
ins ance consis s o xi ep esen ing i s wpas ea u es and yi
ep esen ing i s hnex classes, i.e., nex h alues o p edic :
X ¼ ðx1
;y1Þ;...;ðxN
;yNÞg xi2Rwyi2Rhð1Þ
The da ase is di ided in o h ee ch onologically o de ed
se s: se neighbo s, se pa e ns and se s eaming. The S eamWNN
algo i hm uses he o line-online lea ning app oach o
model da a s eams [35]. The i s wo da a se s a e used in
he ba ch o o line phase o he algo i hm and he las se
in he s eaming o online phase. Big da a s eams
equi emen s ha e o be ul illed only in he online phase.
These equi emen s a e: only a limi ed se o pas da a can
be s o ed; he model has o adap o concep d i quickly
and has o be always eady o make p edic ions; he model
has o wo k in dis ibu ed compu a ional en i onmen s so
ha i s compu a ion is as [36]. In his wo k, an inno a i e
inc emen al lea ning app oach du ing he online phase is
p esen ed. In addi ion, no el and unexpec ed pa e ns in he
incoming s eaming da a a e de ec ed. No el ies a e, as
well, added in o he model. In his way, he algo i hm is
always up o da e.
The p oposed algo i hm is buil on Apache Spa k 2.3.4
and uses HDFS ile sys em on Hadoop 2.7.7 and he Kappa
A chi ec u e on Apache Ka ka 2.11 as s eaming pla o m,
i.e., a single pipeline is speci ically designed o he job.
The me hodology o his algo i hm is de ined in i e
sec ions. Sec ion 3.1 desc ibes he o line phase.
Neu al Compu ing and Applica ions
123
Sec ion 3.2 p esen s he online phase and how eal- ime
o ecas ing is pe o med. Sec ion 3.3 ocuses on he
inc emen al lea ning app oach o he S eamWNN algo-
i hm. Then, Sec . 3.4 de ails how no el pa e ns and
unusual beha io da a a e de ec ed in eal- ime. Finally,
Sec . 3.5 p esen s he model’s app oach o combine
inc emen al lea ning and he inclusion o no el ies in he
model.
3.1 O line lea ning model
The c ea ion o he o line lea ning model is he i s ask o
he algo i hm. I is a e y impo an pa as i is he base
model o he online phase whe e s eaming da a s a o
a i e. This i s phase is based on ba ch p ocessing bu
using dis ibu ed p og amming, which allows o ge a good
model compu ed in a sho ime.
The o line phase uses he se neighbo s and he se pa e ns
ep esen ing app oxima ely 70% and 30% o he ch ono-
logically o de ed da a used o he o line s age. The ba ch
model associa es each ea u e ins ance o he se pa e ns wi h
i s Kcloses ins ances o he se neighbo s. The o line model
is ep esen ed as:
M¼ xi
; yðneighbo 1ðxiÞÞ;...;yðneighbo KðxiÞÞ [[
ð2Þ
whe e xi2Rwa e he ea u es o he i- h ins ance o he
se pa e ns and yðneighbo jðxiÞÞ 2 Rha e he classes o he
ins ance o he se neighbo s selec ed as he j- h closes
neighbo o xi.
The p oximi y be ween he a ibu es o wo ins ances,
one om he se o pa e ns se pa e ns and he o he om he
se o neighbo s se neighbo s, is calcula ed using a use -
speci ied dis ance me ic such as Euclidean, Manha an o
Chebyshe dis ances. The use can also de ine his/he own
dis ance me ic. I can be ep esen ed as dðxi
;xjÞwhe e xi
e e s o he ea u es o he i- h ins ance o he se o pa -
e ns and xj o he ea u es o he j- h ins ance o he se o
neighbo s. Due o he na u e o he da a used in he
expe imen o his scien i ic pape and he analyses pe -
o med on i in [37], he dis ance used in his expe imen is
he Euclidean dis ance.
Once he o line model is gene a ed, p edic ions o he
nex h alues a e made and i s pe o mance is es ed by
calcula ing an e o me ic. In he o line phase, p edic ions
o each alue lin he p edic ion ho izon o leng h ha e
compu ed by:
byl¼1
PK
j¼1ajX
K
j¼1
ajyðneighbo jðxiÞÞl1lhð3Þ
whe e aj ep esen s he dis ance o dðxi
;xjÞde ined as
ollows:
aj¼1
dðxi
;xjÞ2ð4Þ
Closes da a will ha e a g ea e ajdis ance. Finally, he
e o o he p edic ions made in he o line phase is com-
pu ed. Fo his wo k, Mean Absolu e Pe cen age E o
(MAPE) and Mean Absolu e E o (MAE) me ics a e
used. Thus, in he o line s age, he inal e o s MAPEo line
and MAEo line a e he mean o all MAPEiand MAEi,
espec i ely, whe e MAPEiand MAEia e he e o s o he
p edic ions o each i- h ins ance o he se pa e ns and hey
a e de ined as:
MAPEi¼1
hX
h
l¼1
ylbyl
yl
100 1 lhð5Þ
MAEi¼1
hX
h
l¼1
jylbylj1lhð6Þ
whe e ylco esponds o he lclass o he i- h ins ance and
bylis he o line p edic ion de ined by Equa ion (3).
3.2 Real- ime o ecas ing
Once he o line model has been compu ed om Eq. (2) he
online phase o he S eamWNN algo i hm s a s. Da a a e
ecei ed in s eaming and collec ed in ins ances o w ea-
u es, hese da a can be called xs eaming. Fo each xs eaming,
he Euclidean dis ances be ween i and all xiins ances o
he model Ma e calcula ed. No e ha he numbe o dis-
ances calcula ed is he numbe o ins ances o he se o
pa e ns se pa e ns. The one wi h he minimum dis ance dmin
is selec ed as he nea es xi, called xmin om now on.
Once xs eaming is associa ed wi h i s nea es xmin, p e-
dic ions a e compu ed. In his case, online p edic ions
conside no only he K-nea es neighbo s o xmin bu also
xmin i sel as a neighbo o each alue l o p edic in he
p edic ion ho izon o leng h h. Tha is:
byl¼1
aX
K
j¼1
ajyðneighbo jðxminÞÞl
!
þaminyðxminÞl
!
ð7Þ
whe e aand amin a e de ined as:
Neu al Compu ing and Applica ions
123
a¼X
K
j¼1
aj
!
þamin ð8Þ
amin ¼1
dðxmin
;xs eamingÞ2ð9Þ
Then, he MAPEs eaming and MAEs eaming e o me ics o
each i- h ins ance o he se s eaming can be calcula ed using
Equa ions (5) and (6) when he eal class o s eam da a
xs eaming is ecei ed. Thus, in he online s age, he inal
e o s MAPEonline and MAEonline a e he mean o all
MAPEs eaming and MAEs eaming, espec i ely.
The e o e, eal- ime o ecas is pe o med conside ing
he his o ical da a s o ed in he model Mob ained in he
o line phase. Figu e 1p esen s a summa y o he main
s eps o he model when he e is no online upda e. How-
e e , he S eamWNN algo i hm includes h ee mo e di -
e en possibili ies o dynamically upda ing he model
du ing he online phase. These upda es a e explained in
Sec s. 3.3,3.4 and 3.5.
3.3 Inc emen al lea ning
The goal o online inc emen al lea ning is o keep he
model up o da e. This is a e y impo an ask in da a
s eaming algo i hms, as new da a pa e ns may appea and
need o be included in he model. Wi hou his inc emen al
upda e, he model may age and no be sui able o eal- ime
o ecas ing.
The inc emen al lea ning is pe o med by upda ing he
neighbo s o xmin, i.e., neighbo jðxminÞwi h j¼1;...;K.
Fo his eason, i is said ha he model is in e nally
upda ed, since he dimensions o he model Ma e main-
ained bu he componen s a e upda ed conside ing he new
pa e ns in he s eaming da a.
The upda e o neighbo s uses a bu e Bo possible
upda es. Le dmin be he dis ance be ween xs eaming and i s
nea es pa e n xmin, and le dKbe he dis ance be ween xmin
and i s a hes neighbo in he model neighbo KðxminÞ.
Tha is,
dmin ¼dðxmin
;xs eamingÞð10Þ
dK¼dðxmin
;neighbo KðxminÞÞ ð11Þ
The e o e, once he eal- ime o ecas is pe o med, i dmin
is less han dKi means ha he ac ual xs eaming is a mo e
accu a e neighbo o he xmin han i s cu en neighbo s in
he model M. I i occu s, xs eaming is added o he possible
upda e bu e wi h i s co esponding xmin as ollows:
B¼ ðxmin
;xs eaming
;dminÞg ð12Þ
The bu e is illed as many imes as necessa y by adding
ins ances mee ing he condi ion dmin dK o each ins ance
xs eaming in he se s eaming.
The bu e o possible upda es is checked a a speci ic
ime and he e o e, he model is upda ed a ha speci ic
momen . This so-called speci ic ime can depend on a
Fig. 1 Summa y o he online phase o he model wi hou upda e
Neu al Compu ing and Applica ions
123

empo al alue o on an e o alue. On he one hand, he
empo al upda e can be pe o med: e e y day, e e y
mon h, e e y h ee mon hs, e c. On he o he hand, he
o he upda e can be pe o med when he e o o he ac ual
o ecas is highe han a de ined h eshold.
When he so-called speci ic momen occu s, he K
nea es ins ances o xmin in he cu en model Ma e
selec ed along wi h all he xs eaming associa ed wi h xmin in
he bu e . Then, all neighbo s bo h om he cu en model
and om he bu e a e so ed by dis ance and he K
smalles ones a e kep . All neighbo s selec ed a e he
upda ed neighbo s o he xmin in he model M. I is possible
ha all Kneighbo s o a xmin a e upda ed in he model wi h
da a s eaming ins ances.
An example o an upda e o he model when conside ing
h ee neighbo s (K¼3) is illus a ed in he ollowing
equa ion:
M¼ xmin
; yðxs eaming1Þ;yðneighbo 1ðxminÞÞ;
yðxs eaming2Þ[[
ð13Þ
I can be seen ha he nea es and u hes neighbo s a e
upda ed wi h wo s eaming ins ances o he se s eaming and
he neighbo one o he o line model is s ill conside ed a
good neighbo , mo e speci ically, i is he second closes
neighbo .
Figu e 2 ep esen s g aphically he p ocedu e o he
S eamWNN when he inc emen al upda e depends on a
empo al alue ( in he Figu e).
3.4 De ec ion and lea ning o unknown pa e ns
A da a s eaming model equi es he abili y o dynamically
lea n no el pa e ns and di e en ia e hem om unex-
pec ed pa e ns. In his esea ch pape , bo h e ms, i.e.,
no el and unexpec ed pa e ns, a e conside ed unknown
pa e ns since he model could no lea n hem om he
o line o s a ic phase as hey we e no included in he
o line da a. Each o hese ypes o unknown pa e ns needs
o be ea ed independen ly aking in o accoun hei na u e.
On he one hand, a no el pa e n o no el y ep esen s a
newly eme ging concep in he incoming da a. Some o he
u u e incoming da a a e expec ed o ha e a beha io
simila o ha o he eme ging no el y [38]. Conside ing
his, no el ies a e added o he online model as new
ins ances ha upda e he model ex e nally, i.e., he
dimensions o he model inc ease. A no el ins ance
xs eaminglis added o he base model M(see Eq. 2)as
ollows:
M¼ xs eamingl
; yðneighbo 1ðxs eaminglÞÞ;...;
yðneighbo Kðxs eaminglÞÞ [[
ð14Þ
whe e xs eamingl2Rwa e he ea u es o he l- h ins ance o
he s eaming da a (se s eaming) ha is iden i ied as a no el y
and yðneighbo jðxs eaminglÞÞ 2 Rha e he classes o he
ins ance o he en i e o line his o ical da a (se pa e ns and
se neighbo s) selec ed as he j- h closes neighbo o xs eamingl.
On he o he hand, unexpec ed pa e ns o ou lie s in
s eams ep esen an usual beha io which is no supposed
o be epea ed in he u u e incoming da a. The e o e, he
online model does no upda e when an unexpec ed pa e n
is de ec ed. Ne e heless, i igge s an ala m o wa n he
use o ge a deepe insigh in o his da a.
The iden i ica ion o he l- h s eaming ins ance xs eamingl
as no mal, no el o unexpec ed ollows an unsupe ised
lea ning app oach, since he ime se ies a e no labeled.
Consequen ly, he e olu ion o he e o me ic o e ime is
he selec ed app oach o de e mine whe he an unknown
pa e n is co ec ly iden i ied o no . Speci ically, he e o
commi ed be ween he l- h o ecas class ys eamingland he
l- h ac ual class ys eaminglis moni o ed acco dingly:
xs ¼
Unexpec ed i e o (c
ys
;ys Þ[up h
No el i low h e o ðc
ys
;ys Þ up h
No an unknown pa e n o he wise
8
>
<
>
:ð15Þ
whe e up h and low h a e he use -de ined uppe and lowe
e o h esholds o classi ying ins ances as no mal, no el
o unexpec ed. P io o he execu ion o he model, he use
mus de e mine which e o me ic o conside (see Eqs. 6
and 5) and how o de ine he uppe and lowe h esholds.
Typically, hese h esholds a e de ined as a combina ion o
he mean and s anda d de ia ion o he e o o he o line
model.
This concep ion o de e mining he ype o pa e n is
e idenced in se e al s udies such as [39] whe e he
beha io o unknown pa e ns using K-nea es neighbo s-
based echniques we e in es iga ed. Au ho s concluded
wi h he idea ha ou lie s o anomalies occu a away om
hei nea es neighbo s.
Figu e 3shows g aphically he S eamWNN p ocedu e
when unusual pa e ns and no el ies a e de ec ed in he
s eaming da a and how he no el ies a e added o he base
model.
3.5 Inc emen al lea ning and no el ies upda e
The same execu ion o he S eamWNN can pe o m a he
same ime bo h he inc emen al lea ning app oach and he
no el ies app oach. As de ined in Sec . 3.3, he i s
app oach upda es neighbo s in he model. The second
app oach, de ined in Sec . 3.4, iden i ies unusual pa e ns in
eal- ime and upda es he model wi h no el ies. The i s
Neu al Compu ing and Applica ions
123
one is an in e nal upda e and he second one is an ex e nal
upda e.
Figu e 4p esen s an o e iew o he en i e S eamWNN
p ocedu e. In his case, bo h lea ning app oaches a e
included so ha he model can pe o m hem a he same
ime.
4 Resul s
The p oposed algo i hm is un on wo ypes o elec ici y-
ela ed da a, i.e., elec ici y demand and elec ici y p ices,
in Sec s. 4.1 and 4.2, espec i ely. In pa icula ,
Sec s. 4.1.1 and 4.2.1 p esen s he da ase s and pa ame e s
used in each expe imen . Sec ions 4.1.2 and 4.2.2 discuss
he S eamWNN esul s ob ained. Sec ions 4.1.3 and 4.2.3
compa e he S eamWNN esul s wi h hose ob ained by
benchma k o ecas ing algo i hms. Finally, Sec . 4.3
Fig. 2 Summa y o he online phase o he model wi h inc emen al upda e
Neu al Compu ing and Applica ions
123
analyzes he scalabili y and compu a ional complexi y o
he p oposed algo i hm.
4.1 Elec ici y demand
4.1.1 Da ase and expe imen al se ing desc ip ion
The ime se ies used in his expe imen consis s o he
elec ical ene gy consump ion in megawa (MW) in Spain.
The ime se ies has 497,832 samples measu ed e e y
10 min. The his o ical da a con ain all samples om Jan-
ua y 1s 2007 o June 21s 2016, a e a p e-p ocessing s ep
(e.g., adjus men o ime shi days da a) [33]. The whole
da ase is di ided in 3 se s: 70% o he o line pa (70%
o he se neighbo s and 30% o he se pa e ns, espec i ely)
and 30% o he online da a (se s eaming). Thus, he o line
se consis s o da a om Janua y 2007 o mid Augus 2013
Fig. 3 Summa y o he online phase o he model wi h unknown pa e ns de ec ion and lea ning
Neu al Compu ing and Applica ions
123
and he s eaming se om mid Augus 2013 o mid June
2016. Da a a e a ailable online a h ps://www.omie.es.
This esea ch pape epo s he esul s ob ained o he
ollowing pa ame e s: 4 h o p edic ion ho izon (h¼24),
one day o pas -window ea u es (w¼144) and ou
neighbo s o each pa e n (k¼4). An ex ensi e s udy o
he beha io o di e en pa ame e s o he same da ase
can be ound in [37]. The selec ed pa ame e s a e he ones
ha ob ained he mos accu a e esul s.
Fig. 4 O e iew o he en i e p ocess o S eamWNN
Neu al Compu ing and Applica ions
123
4.3 Scalabili y and complexi y analysis
A e y impo an aspec o algo i hms ha wo k in
s eaming is o achie e eal- ime esul s du ing he online
phase. Fo his, i is e y impo an ha he algo i hm is
scalable so ha he execu ion imes a e no a ec ed
exponen ially when he se o pas da a inc eases. Figu e 12
p esen s he execu ion ime spen o he p edic ion o he
demand elec ici y da ase o ou di e en o ecas ho i-
zons wi h online daily upda e. These p edic ion ho izons
a e: h¼24 (wi h w¼144), h¼24 (wi h w¼288), h¼
72 (w¼576) and h¼144 (w¼864). The conclusions
p esen ed a e he same as hose ob ained o he p ice
da ase s. I can be no ed ha he numbe o i e a ions o
each p edic ion ho izon is di e en as wand h alues a e
di e en . The execu ion ime inc eases linea ly e sus
i e a ions o all p edic ion ho izons, bu he sho e he
p edic ion ho izon, he highe he scalabili y o he p o-
posed p edic ion algo i hm, as a line wi h a smalle slope
can be seen in he Figu e. Thus, i can be concluded ha he
algo i hm is scalable and sui able o deal wi h big da a.
Ano he impo an conside a ion gi en he na u e o he
S eamWNN is i s compu a ional complexi y. In he o line
phase, whe e he e a e no s eaming cons ain s, i is
oðknwÞ, being k he numbe o neighbo s o conside , n
he leng h o he se neighbo s and w he ixed leng h o he
pas alues used o p edic , as de ined in Sec . 3. In he
online phase, he eal- ime equi emen s a e me and he
compu a ional complexi y is o(1) since he en i e model is
al eady c ea ed [37].
5 Conclusions
In his pape , a new o ecas ing algo i hm has been p o-
posed o p edic elec ici y demand and elec ici y p ices
ime se ies in eal- ime. As p e ious s ep o he p edic ion,
an ini ial o ecas ing model based on he K-nea es
neighbo s algo i hm has been ob ained using his o ical
da a. This model is composed o a se o pa e ns along
wi h i s kco esponding nea es neighbo s. Thus, he inal
p edic ion has been compu ed using he K-nea es neigh-
bo s o he nea es pa e n o he s eaming da a. In his
way, p edic ions can be ob ained in eal- ime because i is
no necessa y o compu e he K-nea es neighbo s each
ime a p edic ion is pe o med as hese Kneighbo s a e
al eady compu ed. The algo i hm has been success ully
applied, ob aining accu a e p edic ions o e ime by
inc emen ally upda ing he model. This upda e consis s o
upda ing he neighbo s in eal- ime wi h he new da a
Fig. 11 Examples o no el ies de ec ed in ene gy p ice no mal da ase
Neu al Compu ing and Applica ions
123

ecei ed in s eaming. In addi ion, he algo i hm has been
able o ind no el pa e ns ha i has inco po a ed in o he
model by upda ing i . Di e en unusual pa e ns in he eal-
ime p edic ions ha e also been de ec ed. Di e en
pa ame e s o he upda e’s op ions ha e been es ed and
he un imes o calcula ing he eal- ime p edic ion show
ha he algo i hm is e icien as well as scalable wi h
espec o he numbe o i e a ions. In u u e wo k he
algo i hm will be de eloped o be sui able o wo k wi h
s eaming mul i a ia e ime se ies and o sol e bo h
eg ession and classi ica ion p oblems in eal- ime.
Acknowledgemen s The au ho s would like o hank he Spanish
Minis y o Science, Inno a ion and Uni e si ies o he suppo unde
P ojec s PID2020-117954RB-C2, TED2021-131311B-C22 and
PID2023-146037OB-C22.
Funding Open Access unding p o ided hanks o he CRUE-CSIC
ag eemen wi h Sp inge Na u e.
Da a a ailabili y The da a ha suppo he indings o his s udy a e
a ailable in h ps://www.esios. ee.es and h ps://www.omie.es.
Decla a ions
Con lic o in e es The au ho s decla e ha hey ha e no con lic o
in e es .
Open Access This a icle is licensed unde a C ea i e Commons
A ibu ion 4.0 In e na ional License, which pe mi s use, sha ing,
adap a ion, dis ibu ion and ep oduc ion in any medium o o ma , as
long as you gi e app op ia e c edi o he o iginal au ho (s) and he
sou ce, p o ide a link o he C ea i e Commons licence, and indica e
i changes we e made. The images o o he hi d pa y ma e ial in his
a icle a e included in he a icle’s C ea i e Commons licence, unless
indica ed o he wise in a c edi line o he ma e ial. I ma e ial is no
included in he a icle’s C ea i e Commons licence and you in ended
use is no pe mi ed by s a u o y egula ion o exceeds he pe mi ed
use, you will need o ob ain pe mission di ec ly om he copy igh
holde . To iew a copy o his licence, isi h p://c ea i ecommons.
o g/licenses/by/4.0/.
Re e ences
1. Sahal R, B eslin JG, Ali MI (2020) Big da a and s eam p o-
cessing pla o ms o Indus y 4.0 equi emen s mapping o a
p edic i e main enance use case. J Manu Sys 54:138–151
2. Bi e A, Hamme B, Schlei FM (2019) Recen ends in
s eaming da a analysis, concep d i and analysis o dynamic
da a se s. In: 27 h Eu opean symposium on a i icial neu al ne -
wo ks (ESANN), pp 421–430
3. Shi a aman N, Saki S, Liu Z, Ramana han S, Easwa an A,
S einho s S (2020) Real- ime ene gy moni o ing in IoT-enabled
mobile de ices . In: P oceedings o he 23 h design, au oma ion
es in eu ope con e ence exhibi ion (DATE), pp 991–994
4. Alizadeh M, Behesh i MTH, Ramezani A, Bolouki S (2023) An
op imized hyb id me hodology o sho - e m a ic o ecas ing
in elecommunica ion ne wo ks. T ans Eme g Telecommun
Technol 34(12):4860
5. Alizadeh M, Behesh i MTH, Ramezani A, Saada inezhad H
(2020) Ne wo k a ic o ecas ing based on ixed elecommuni-
ca ion da a using deep lea ning. In: 2020 6 h I anian con e ence
on signal p ocessing and in elligen sys ems (ICSPIS), pp 1–7
6. Alizadeh M, Mousa i SE, Behesh i MTH, Os adi A (2021)
Combina ion o ea u e selec ion and hyb id classi ie as o ne -
wo k in usion de ec ion sys em adop ing a, gwo, and ba op i-
mize s. In: 2021 7 h In e na ional con e ence on signal
p ocessing and in elligen sys ems (ICSPIS), pp 1–7
7. Alo hali E, Alashwal H, Ha ous S (2019) Da a s eam mining
echniques: a e iew. Telecommun Compu Elec on Con ol
17(2):728–737
Table 5 Fo ecas e o esul s o he s eaming phase o he elec-
ici y p ice da ase
Algo i hm MAE (€/MWh) MAPE (%)
S eamWNN online daily ?no el ies 3.57 8.35
MLP 3.79 8.52
Passi e-agg essi e lea ning 27.5 13.73
AMRules 5.09 12.93
Hoe ding T ee 3.75 9.11
Hoedding Adap i e T ee 3.31 7.19
(a) No mal pe iod
S eamWNN online daily ?no el ies 2.44 8.87
MLP 2.72 9.93
Passi e-agg essi e lea ning 6.11 19.94
AMRules 3.03 11.94
Hoe ding ee 3.44 12.25
Hoedding adap i e ee 3.66 12.93
(b) Qua an ine pe iod
S eamWNN online daily ?no el ies 3.68 5.47
MLP 3.73 5.69
Passi e-agg essi e lea ning 8.45 12.66
AMRules 5.42 8.09
Hoe ding ee 3.75 5.68
Hoedding adap i e ee 3.40 5.14
(c) F aud pe iod
The bes esul s a e p esen ed in bold
Fig. 12 Execu ion ime e sus numbe o i e a ions o daily neighbo
upda ing in he online phase
Neu al Compu ing and Applica ions
123
8. Roosa K, Lee Y, Luo R, Ki pich A, Ro henbe g R, Hyman JM,
Yan P, Chowell G (2020) Real- ime o ecas s o he COVID-19
epidemic in China om Feb ua y 5 h o Feb ua y 24 h, 2020.
In ec Dis Model 5:256–263
9. Mo ei a-Ma ias L, Gama J, Fe ei a M, Mendes-Mo ei a J,
Damas L (2013) P edic ing axi-passenge demand using
s eaming da a. IEEE T ans In ell T ansp Sys 14:1393–1402
10. Melga -Ga cı
´a L, Godinho MT, Espada R, Gu ie
´ ez-A ile
´sD,
B i o IS, Ma ı
´nez-A
´l a ez F, T oncoso A, Rubio-Escude o C
(2021) Disco e ing spa io- empo al pa e ns in p ecision ag i-
cul u e based on iclus e ing. In: P oceedings o he 15 h in e -
na ional con e ence on so compu ing models in indus ial and
en i onmen al applica ions (SOCO). Sp inge , Cham,
pp 226–236
11. Melga -Ga cı
´a L, Gu ie
´ ez-A ile
´s D, Rubio-Escude o C, T on-
coso A (2021) Disco e ing h ee-dimensional pa e ns in eal-
ime om da a s eams: an online iclus e ing app oach. In Sci
558:174–193
12. Melga -Ga cı
´a L, Gu ie
´ ez-A ile
´s D, Rubio-Escude o C, T on-
coso A (2020) High-con en sc eening images s eaming analysis
using he ST iGen me hodology. In: P oceedings o he 35 h
annual associa ion o compu ing machine y symposium on
applied compu ing (SAC), pp 537–539
13. Yaseen ZM, El-sha ie A, Jaa a O, A an HA, Sayl KN (2015)
A i icial in elligence based models o s eam- low o ecas ing:
2000–2015. J Hyd ol 530:829–844
14. Jime
´nez-He e a P, Melga -Ga cı
´a L, Asencio-Co e
´s G, T on-
coso A (2020) A new o ecas ing algo i hm based on neighbo s
o s eaming elec ici y ime se ies. In: P oceedings o he 15 h
in e na ional con e ence on hyb id a i icial in elligen sys ems
(HAIS). Sp inge , Cham, pp 522–533
15. Qiu X, Sugan han PN, Ama a unga GAJ (2018) Ensemble
inc emen al lea ning andom ec o unc ional link ne wo k o
sho - e m elec ic load o ecas ing. Knowl-Based Sys
145:182–196
16. Wang P, Xu K, Ding Z, Du Y, Liu W, Sun B, Zhu Z, Tang H
(2022) An online elec ici y ma ke p ice o ecas ing me hod ia
andom o es . IEEE T ans Ind Appl 58(6):7013–7021
17. Sai W, Pan Z, Liu S, Jiao Z, Zhong Z, Miao B, Chan SH (2023)
E en -d i en o ecas ing o wholesale elec ici y p ice and e-
quency egula ion p ice using machine lea ning algo i hms. Appl
Ene gy 352:121989
18. Pe ez-Chaco
´n R, Tala e a-Llames RL, Ma ı
´nez-A
´l a ez F,
T oncoso A (2016) Finding elec ic ene gy consump ion pa e ns
in big ime se ies da a. In: P oceedings o he 13 h in e na ional
con e ence on dis ibu ed compu ing and a i icial in elligence
(DCAI), pp 231–238
19. Tala e a-Llames RL, Pe
´ ez-Chaco
´n R, Ma ı
´nez-Balles e os M,
T oncoso A, Ma ı
´nez-A
´l a ez F (2016) A nea es neighbou s-
based algo i hm o big ime se ies da a o ecas ing. In: P o-
ceedings o he 11 h in e na ional con e ence on hyb id a i icial
in elligen sys ems (HAIS), pp 174–185
20. We on R (2014) Elec ici y p ice o ecas ing: a e iew o he
s a e-o - he-a wi h a look in o he u u e. In J Fo ecas
30(4):1030–1081
21. Liu L, Bai F, Su C, Ma C, Yan R, Li H, Sun Q, Wenne s en R
(2022) Fo ecas ing he occu ence o ex eme elec ici y p ices
using a mul i a ia e logis ic eg ession model. Ene gy
247:123417
22. Meh dous F, Noo ani I, B ahim Belhaoua i S (2023) Fo ecas ing
no dic elec ici y spo p ice using deep lea ning ne wo ks. Neu al
Compu Appl 19169–19185
23. Magalha
˜es BG, Ben o PMR, Pombo JAN, Calado MRA, Ma iano
SJPS (2023) Spo p ice o ecas ing o bes ading s a egy
decision suppo in he Ibe ian elec ici y ma ke . Expe Sys
Appl 224:120059
24. Liu K, Li Z, Yao C, Chen J, Zhang K, Sai ullah M (2016)
Coupling he k-nea es neighbo p ocedu e wi h he Kalman il e
o eal- ime upda ing o he hyd aulic model in lood o ecas ing.
In J Sedim Res 31(2):149–158
25. Komma J, Blo
¨schl G, Reszle C (2008) Soil mois u e upda ing by
ensemble Kalman il e ing in eal- ime lood o ecas ing.
J Hyd ol 357(3):228–242
26. Thomas RQ, Figuei edo RJ, Daneshmand V, Bookou BJ, Pucke
LK, Ca ey CC (2020) A nea - e m i e a i e o ecas ing sys em
success ully p edic s ese oi hyd odynamics and pa i ions
unce ain y in eal ime. Wa e Resou Res 56(11):20
27. Nanda T, Sahoo B, Cha e jee C (2019) Enhancing eal- ime
s eam low o ecas s wi h wa ele -neu al ne wo k based e o -
upda ing schemes and ECMWF me eo ological p edic ions in
a iable in il a ion capaci y model. J Hyd ol 575:890–910
28. Yan L, Feng J, Wu Y, Hang T (2020) Da a-d i en as eal- ime
lood o ecas ing model o p ocessing concep d i . cloud
compu ing. In: Sma g id and inno a i e on ie s in elecom-
munica ions. Sp inge , Cham, pp 363–374
29. Sun L, Ji Y, Zhu M, Gu F, Dai F, Li K (2021) A new p edic i e
me hod suppo ing s eaming da a wi h hyb id ecu ing concep
d i s in p ocess indus y. Compu Ind Eng 161:107625
30. Yang H, Schell KR (2021) Real- ime elec ici y p ice o ecas ing
o wind a ms wi h deep neu al ne wo k ans e lea ning and
hyb id da ase s. Appl Ene gy 299:117242
31. Yang H, Schell KR (2022) Gh ne : i-b anch deep lea ning
ne wo k o eal- ime elec ici y p ice o ecas ing. Ene gy
238:122052
32. Yang H, Schell KR (2022) Qcae: a quad uple b anch CNN
au oencode o eal- ime elec ici y p ice o ecas ing. In J Elec
Powe Ene gy Sys 141:108092
33. Melga -Ga cı
´a L, Gu ie
´ ez-A ile
´s D, Rubio-Escude o C, T on-
coso A (2021) Nea es neighbo s-based o ecas ing o elec ici y
demand ime se ies in s eaming. In: Ad ances in a i icial
in elligence. Sp inge , Cham, pp 185–195
34. Je e s J, Reinde s J, Sodani A (2016) Chap e 24-Machine
lea ning. In: In el Xeon Phi p ocesso high pe o mance p o-
g amming, 2nd edn, pp 527–548
35. La anaga P, A ienza D, Rozo JD, Ogbechie A, Pue o-San ana C,
Bielza C (2018) Indus ial applica ions o machine lea ning. CRC
P ess, Boca Ra on
36. Benczu
´ AA, Kocsis L, Pa
´lo ics R (2019) Online machine
lea ning algo i hms o e da a s eams. In: Encyclopedia o big
da a echnologies. Sp inge , pp 1199–1207
37. Melga -Ga cı
´a L, Gu ie
´ ez-A ile
´s D, Rubio-Escude o C, T on-
coso A (2023) Iden i ying no el ies and anomalies o inc e-
men al lea ning in s eaming ime se ies o ecas ing. Eng Appl
A i In ell 123:106326
38. Fa ia ER, Gonc¸al es IJCR, Ca alho ACPLF, Gama J (2016)
No el y de ec ion in da a s eams. A i In ell Re 45:235–269
39. Chandola V, Bane jee A, Kuma V (2009) Anomaly de ec ion: a
su ey. ACM Compu Su 41(3)
40. T ull O, Ga cı
´a-Dı
´az JC, T oncoso A (2019) Applica ion o
disc e e-in e al mo ing seasonali ies o Spanish elec ici y
demand o ecas ing du ing Eas e . Ene gies 12(6):1083
41. T ull O, Ga cı
´a-Dı
´az JC, T oncoso A (2021) One-day-ahead
elec ici y demand o ecas ing in holidays using disc e e-in e al
mo ing seasonali ies. Ene gy 231:120966
42. Vega-Ma
´ quez B, Rubio-Escude o C, Nepomuceno-Chamo o
IA, A cos-Va gas A (2021) Use o deep lea ning a chi ec u es o
day-ahead elec ici y p ice o ecas ing o e di e en ime pe iods
in he spanish elec ici y ma ke . Appl Sci 11(13)
43. Py hon: Ri e . h ps:// i e ml.xyz/la es /. Accessed 01 Sep 2024
(2024)
Neu al Compu ing and Applica ions
123