Yarın Türkiye Ne Kadar Elektrik Tüketecek? Gün Öncesi Talep TahminiHow Much Electricity Will Turkey Use Tomorrow? Day-Ahead Demand Forecasting
Dokuz yıllık saatlik tüketim verisiyle ertesi günün 24 saatini tahmin eden bir model kurdum, 57 ay boyunca geriye dönük sınadım ve resmi gün öncesi tahminle karşılaştırdım.I built a model that forecasts the next day's 24 hours from nine years of hourly consumption data, backtested it over 57 months and compared it with the official day-ahead forecast.
- Python
- Scikit-learn
- Time Series
- Backtesting
Elektrik depolanamıyor; her saat tüketildiği kadar üretilmesi gerekiyor. Bu yüzden ertesi günün tüketimi bir gün önceden, saat saat tahmin edilir. Bu çalışmada Türkiye'nin 85.584 saatlik tüketim verisiyle böyle bir tahmin modeli kurdum ve onu gerçek hayattaki gibi, her gün yalnızca o güne kadar bilinenlerle sınadım.
Soru ve kural
Tahmin edilen şey, yarının (D günü) 24 saatinin her biri için Türkiye'nin toplam elektrik tüketimi. Kural şu: model, D günü için tahmin yaparken en geç D−2 gününün sonuna kadar gerçekleşen tüketimi görebilir. Aradaki bir gün, tahminin bir gün önceden verilmesi gerektiği için boş kalıyor.
Hata ölçüsü olarak ortalama mutlak yüzde hatayı (MAPE) kullandım: her saat için tahminin gerçekleşenden yüzde kaç saptığının ortalaması.
Veri
- Veriyi
topla - Tüketimi
tanı - Özellik
üret - Geriye dönük
sına - Resmi tahminle
kıyasla
- Tüketim: EPİAŞ Şeffaflık Platformu'ndaki gerçek zamanlı tüketim serisi, 1 Ocak 2017 – 6 Ekim 2026. 85.584 saat, tek bir eksik ya da tekrarlı saat yok. Türkiye 2016'dan beri yaz saati uygulamadığı için saat kayması sorunu da yok.
- Sıcaklık: Open-Meteo arşivinden İstanbul, Ankara, İzmir, Adana ve Erzurum'un saatlik sıcaklığı.
- Takvim: Resmi tatiller ve dini bayramlar; arife, bayram ertesi, köprü günleri ve Ramazan ayını bunlardan türettim.
- Resmi tahmin: Aynı platformda yayımlanan Yük Tahmin Planı, yani bir sonraki gün için yapılan resmi saatlik tahmin. Kıyas için kullandım.
Tüketimi ne belirliyor?
Modelden önce seriye baktım; iyi bir tahmin modeli, tüketimi oynatan şeyleri bilmek zorunda.
Günün saati ve haftanın günü
İş günlerinde tüketim sabah 05:00'te dibe iniyor, 08:00'den sonra hızla yükselip 11:00'de en yüksek noktasına çıkıyor. Hafta sonu sabah yükselişi daha yavaş ve tepe akşam 20:00'de. Pazar günleri tüketim ortalamanın %12 altında.
Sıcaklık
Tatil olmayan iş günleri. Sıcaklık beş şehrin ortalaması.
Eğri U biçiminde. Tüketim 14–18 °C arasında en düşük (−%8); hava ısındıkça klima yükü geliyor ve 26 °C'nin üstünde tüketim yıl ortalamasının %16 üzerine çıkıyor. Soğukta artış çok daha küçük (+%3), çünkü ısınmanın büyük kısmı elektrikle değil doğal gazla yapılıyor. Serinin rekoru da bir yaz öğleden sonrası: 28 Temmuz 2025, saat 14:00, 59.504 MW.
Tatiller
Her gün, üç hafta öncesi ve sonrasındaki aynı haftanın günlerinin medyanıyla karşılaştırıldı.
Dini bayramlarda tüketim normal bir güne göre %28 düşüyor; ilk gün %30,1, dördüncü gün %23,5. Arife günü bile %19 düşük. Bayramların tarihi her yıl yaklaşık 11 gün geriye kaydığı için bu etki mevsimsellikle yakalanamıyor; takvimin modele açıkça verilmesi gerekiyor.
Seride bir de pandemi izi var: Nisan 2020'de tüketim bir önceki yılın aynı ayına göre %15, Mayıs 2020'de %17 düşük.
Model
Gradyan artırmalı karar ağaçları (scikit-learn, HistGradientBoostingRegressor) kullandım. Modele verdiğim bilgiler:
- Geçmiş tüketim: Aynı saatin 2, 3, 7 ve 14 gün önceki değeri, son haftanın seviyesi ve eğilimi.
- Takvim: Saat, haftanın günü, yılın günü, tatil türü, bayramın kaçıncı günü, arife, köprü günü, Ramazan.
- Geçmişteki tatiller: Kıyas alınan günlerden kaçı tatildi? Bu olmadan model, bayramdan sonraki haftada bayramın düşük tüketimini “normal” sanıyor.
- Sıcaklık (ikinci modelde): Tahmin gününün sıcaklığı ve son haftaya göre farkı.
Geriye dönük test
Modeli tek bir eğitim ve test bölmesiyle sınamadım. Ocak 2022'den Eylül 2026'ya kadar her ayın başında, o güne kadar bilinen veriyle yeniden eğittim ve yalnızca o ayı tahmin ettirdim: 57 ay, 1.734 gün, 41.616 saat. Model ayarlarını test sonuçlarına bakarak değiştirmedim.
Sonuçlar
| Yöntem | Saatlik hata (MAPE) | Ortalama hata (MW) | Günün tepe saati | Günlük toplam |
|---|---|---|---|---|
| İki gün öncesinin aynı saati | %8,0 | 3.008 | %7,7 | %7,3 |
| Geçen haftanın aynı saati | %5,2 | 1.921 | %5,1 | %4,9 |
| Model, sıcaklık bilgisi olmadan | %2,1 | 816 | %2,2 | %1,8 |
| Model, sıcaklıklakusursuz hava tahmini varsayımı | %1,7 | 642 | %1,6 | %1,3 |
- Basit taban zor geçilen bir çıta değil ama gerekli. “Geçen haftanın aynı saati” %5,2 hata veriyor. Model bunu %2,1'e indiriyor.
- Günlerin %77'sinde günlük hata %2'nin altında. Medyan gün hatası %1,27; ortalamayı az sayıda kötü gün yukarı çekiyor.
- Sıcaklık bilgisi hatayı beşte bir azaltıyor, ama bu rakam tahmin gününün gerçekleşen sıcaklığıyla hesaplandı. Aşağıda bunun ne kadar iyimser olduğuna bakıyorum.
Asıl fark tatillerde
Normal günlerde model tabanın hatasını yarıya indiriyor. Dini bayramlarda taban %38 yanılıyor, çünkü bayram gününe geçen haftanın normal gününü kopyalıyor; model %4'te kalıyor. En zor gün arife: yarım gün çalışılıyor ve yılda yalnızca iki kez yaşanıyor.
Gölgeli bant modelin tahmin aralığı. Bayram 27–30 Mayıs.
Grafikte iki şey görülüyor. Taban bayramda çok yüksek, bayramdan sonraki hafta ise çok düşük kalıyor, çünkü bu kez bayram haftasını kopyalıyor. Model ikisinde de gerçekleşeni izliyor; ama bayramdan önceki iki günde (25–26 Mayıs) o da yüksek kalıyor. Nedeni aşağıda.
Sıcaklık bilgisi ne kadar işe yarıyor?
Sıcaklık en çok haziran ve temmuzda işe yarıyor: klima yükü havaya çok duyarlı. Mayıs ve ekim gibi ılıman aylarda iki model birbirine yakın.
Ne kadar arasında olduğunu görmek için sıcaklığa bilerek hata ekledim: her güne rastgele, o gün boyunca sabit bir sapma. 2025 öncesiyle eğitilen model, 2025–2026'da şu sonuçları verdi:
| Hava tahmininin günlük hatası | Modelin hatası (MAPE) |
|---|---|
| Hata yok (gerçekleşen sıcaklık) | %1,67 |
| ±1 °C | %1,81 |
| ±2 °C | %2,07 |
| ±3 °C | %2,33 |
| Sıcaklığı hiç kullanmayan model | %2,16 |
Hava tahmini günde ortalama 2 °C şaşsa bile sıcaklığı kullanmak, hiç kullanmamaktan iyi. 3 °C'de avantaj kayboluyor. Ertesi gün için hava tahminleri genellikle bundan isabetli olduğundan, sıcaklık modelde tutulmaya değer.
Resmi tahminle karşılaştırma
EPİAŞ'ta her gün, ertesi gün için resmi bir saatlik tahmin yayımlanıyor: Yük Tahmin Planı. Aynı 41.592 saatte, aynı gerçekleşen değerlere karşı ikisini yan yana koydum.
| Resmi plan | Model, sıcaklıksız | Model, sıcaklıkla | |
|---|---|---|---|
| Bütün saatler (MAPE) | %3,03 | %2,10 | %1,68 |
| Medyan saatlik hata | %2,24 | %1,53 | %1,16 |
| Planın bozuk göründüğü 11 gün hariç | %2,90 | %2,07 | %1,65 |
| 2022 | %2,81 | %2,16 | %1,76 |
| 2023 | %2,85 | %1,99 | %1,66 |
| 2024 | %3,52 | %2,10 | %1,64 |
| 2025 | %3,07 | %1,98 | %1,57 |
| 2026 | %2,82 | %2,31 | %1,82 |
Bu veride model, sıcaklık bilgisi olmadan bile resmi plandan düşük hata verdi ve günlerin %71'inde daha isabetliydi. Sonuç beş yılın her birinde aynı yönde.
Tahmin ne kadar emin?
Tek bir sayı yerine bir aralık vermek çoğu zaman daha kullanışlı: “yarın saat 14:00'te tüketim yüzde 80 olasılıkla şu iki değer arasında.” Bunun için aynı modeli %10 ve %90 dilimlerini tahmin edecek biçimde iki kez daha eğittim. İyi bir aralığın, gerçekleşen değerlerin %80'ini içermesi gerekir.
| Gün tipi | Ham aralık | Geçmiş hatalarla ayarlanmış |
|---|---|---|
| İş günü | %64,5 | %80,7 |
| Hafta sonu | %67,9 | %81,4 |
| Resmi tatil | %69,5 | %77,3 |
| Arife | %52,1 | %58,8 |
| Dini bayram | %66,9 | %72,5 |
| Hepsi | %65,5 | %80,6 |
Ham aralık fazla dar çıktı: gerçekleşen değerlerin yalnızca %65'i içinde kaldı. Model, kendinden olması gerekenden emin. Bunu düzeltmek için her ay, aralığı önceki on iki ayın test hatalarına bakarak genişlettim (conformal yöntem). Kapsama %81'e çıktı; aralığın ortalama genişliği tüketimin %5,6'sı.
Düzeltme ortalamayı tutturuyor ama her gün tipini değil: arife günlerinde kapsama %59. Modelin en çok yanıldığı günler, yanılabileceğini en az bildiği günler.
Modelin en çok yanıldığı günler
| Gün | Günün hatası (MAPE) | Tahmin gerçekleşenden | Ne oldu? |
|---|---|---|---|
| 26 Oca 2022 | %15,4 | %15 yüksek | Sanayiye planlı elektrik kesintisi |
| 25 Oca 2022 | %14,6 | %15 yüksek | Sanayiye planlı elektrik kesintisi |
| 1 May 2022 | %14,2 | %14 yüksek | Ramazan Bayramı arifesi ve 1 Mayıs aynı gün |
| 7 Şub 2023 | %12,4 | %12 yüksek | Kahramanmaraş depremleri |
| 5 May 2022 | %11,6 | %11 yüksek | Bayramı hafta sonuna bağlayan iş günü |
| 26 May 2026 | %10,9 | %11 yüksek | Bayram öncesi idari izin (arife) |
| 6 Şub 2023 | %10,5 | %11 yüksek | Kahramanmaraş depremleri |
| 24 Oca 2022 | %9,9 | %10 yüksek | Sanayiye planlı elektrik kesintisi |
| 25 May 2026 | %9,6 | %10 yüksek | Bayram öncesi idari izin |
En kötü dokuz günün hepsinde model tüketimi olduğundan yüksek tahmin etti ve bunlar üç gruba ayrılıyor:
- Öngörülemeyen olaylar. Ocak 2022'de doğal gaz sıkıntısı nedeniyle sanayiye uygulanan planlı elektrik kesintisi ve Şubat 2023'teki depremler. Geçmiş tüketime bakan hiçbir model bunları önceden bilemez.
- Takvimde olmayan tatiller. Bayram tatili idari izinle dokuz güne uzatıldığında, aradaki iş günleri fiilen tatil oluyor. Kullandığım takvimde bu günler yok.
- Üst üste binen tatiller. 1 Mayıs 2022 hem arife hem resmi tatildi; veride böyle bir gün daha önce hiç yoktu.
İkinci grup düzeltilebilir: idari izinler genellikle haftalar önceden açıklanıyor ve takvime elle eklenebilir. Bu, modelde yapılacak ilk iyileştirme.
Sınırlar
Sonuç
İyi bir talep tahmininin büyük kısmı model seçiminden değil, üç şeyden geldi: hedefi doğru kurmak (megavat yerine son haftaya oran), takvimi modele açıkça vermek ve modeli gerçekte kullanılacağı gibi, her gün yalnızca o güne kadar bilinenlerle sınamak.
Ortalama hata iyi bir özet değil. Model günlerin çoğunda %2'nin altında yanılıyor; asıl risk yılda birkaç günde toplanıyor ve o günlerin çoğu takvimle ilgili. Tahmini kullanan biri için “ortalama hata kaç” sorusundan daha yararlı soru, “hangi günlerde güvenmemeliyim” sorusu.
Veri: EPİAŞ Şeffaflık Platformu (gerçek zamanlı tüketim ve yük tahmin planı), Open-Meteo (sıcaklık). Test dönemi 1 Ocak 2022 – 30 Eylül 2026.
Electricity cannot be stored; every hour, as much has to be generated as is consumed. That is why the next day's consumption is forecast a day ahead, hour by hour. In this study I built such a forecasting model from 85,584 hours of Turkey's consumption data and tested it the way it would be used in real life, each day with only what was known up to that day.
The question and the rule
The target is Turkey's total electricity consumption for each of the 24 hours of tomorrow (day D). The rule: when forecasting day D, the model may see consumption only up to the end of day D−2. The day in between is left out because the forecast has to be delivered a day in advance.
As the error measure I used the mean absolute percentage error (MAPE): the average, over hours, of how far the forecast is from the actual value in percent.
Data
- Collect
the data - Understand
consumption - Build
features - Backtest
- Compare with the
official forecast
- Consumption: The real-time consumption series on the EPİAŞ Transparency Platform, January 1, 2017 – October 6, 2026. 85,584 hours with no missing or duplicated hour. Turkey has not used daylight saving time since 2016, so there is no clock-shift problem either.
- Temperature: Hourly temperature for Istanbul, Ankara, Izmir, Adana and Erzurum from the Open-Meteo archive.
- Calendar: Public and religious holidays; from these I derived holiday eves, the day after, bridge days and the month of Ramadan.
- Official forecast: The Load Forecast Plan published on the same platform, the official hourly forecast for the next day. I used it as a benchmark.
What drives consumption?
I looked at the series before modelling; a good forecasting model has to know what moves consumption.
Hour of the day and day of the week
On working days consumption bottoms out at 05:00, climbs quickly after 08:00 and peaks at 11:00. On weekends the morning rise is slower and the peak comes at 20:00. On Sundays consumption is 12% below average.
Temperature
Working days that are not holidays. Temperature is the mean of five cities.
The curve is U-shaped. Consumption is lowest between 14 and 18 °C (−8%); as it gets hotter the air-conditioning load arrives, and above 26 °C consumption is 16% above the yearly mean. The rise in the cold is much smaller (+3%), because most heating runs on natural gas, not electricity. The record in the series is also a summer afternoon: July 28, 2025, at 14:00, 59,504 MW.
Holidays
Each day is compared with the median of the same weekdays in the three weeks before and after.
On religious holidays consumption is 28% lower than on a normal day; 30.1% on the first day and 23.5% on the fourth. Even the eve is 19% lower. Because these holidays move about 11 days earlier every year, seasonality cannot capture the effect; the calendar has to be given to the model explicitly.
The series also carries a trace of the pandemic: consumption in April 2020 was 15% lower than in the same month a year earlier, and 17% lower in May 2020.
Model
I used gradient-boosted decision trees (scikit-learn, HistGradientBoostingRegressor). What the model is given:
- Past consumption: The same hour 2, 3, 7 and 14 days earlier, plus the level and trend of the last week.
- Calendar: Hour, day of week, day of year, holiday type, which day of the religious holiday, eve, bridge day, Ramadan.
- Holidays in the past: How many of the reference days were holidays? Without this, in the week after a holiday the model takes the holiday's low consumption for “normal”.
- Temperature (in the second model): The temperature of the forecast day and its difference from the last week.
Backtest
I did not test the model with a single train and test split. From January 2022 to September 2026, at the start of every month I retrained it on the data known up to that day and had it forecast only that month: 57 months, 1,734 days, 41,616 hours. I did not change the model settings after looking at test results.
Results
| Method | Hourly error (MAPE) | Mean error (MW) | Daily peak hour | Daily total |
|---|---|---|---|---|
| Same hour two days earlier | 8.0% | 3,008 | 7.7% | 7.3% |
| Same hour last week | 5.2% | 1,921 | 5.1% | 4.9% |
| Model without temperature | 2.1% | 816 | 2.2% | 1.8% |
| Model with temperatureassumes a perfect weather forecast | 1.7% | 642 | 1.6% | 1.3% |
- The simple baseline is not a hard bar to clear, but it is a necessary one. “The same hour last week” gives an error of 5.2%. The model brings that down to 2.1%.
- On 77% of days the daily error is below 2%. The median daily error is 1.27%; a small number of bad days pull the mean up.
- Temperature cuts the error by a fifth, but that figure was computed with the actual temperature of the forecast day. Below I look at how optimistic that is.
The real difference is on holidays
On normal days the model halves the baseline's error. On religious holidays the baseline is off by 38%, because it copies last week's normal day onto the holiday; the model stays at 4%. The hardest day is the eve: people work half a day, and it happens only twice a year.
The shaded band is the model's prediction interval. The holiday ran from May 27 to 30.
The chart shows two things. The baseline is far too high during the holiday and far too low in the week after, because then it copies the holiday week. The model follows the actual values in both; but on the two days before the holiday (May 25–26) it, too, stays high. The reason is below.
How much does temperature help?
Temperature helps most in June and July: the air-conditioning load is very sensitive to the weather. In mild months such as May and October the two models are close.
To see where in between, I deliberately added error to the temperature: a random offset for each day, constant through that day. A model trained on data before 2025 gave these results for 2025–2026:
| Daily error of the weather forecast | Model error (MAPE) |
|---|---|
| No error (actual temperature) | 1.67% |
| ±1 °C | 1.81% |
| ±2 °C | 2.07% |
| ±3 °C | 2.33% |
| Model that does not use temperature | 2.16% |
Even if the weather forecast is off by 2 °C a day on average, using temperature beats not using it. At 3 °C the advantage is gone. Next-day weather forecasts are usually more accurate than that, so temperature is worth keeping in the model.
Comparison with the official forecast
EPİAŞ publishes an official hourly forecast for the next day, every day: the Load Forecast Plan. I put the two side by side over the same 41,592 hours, against the same actual values.
| Official plan | Model, no temperature | Model, with temperature | |
|---|---|---|---|
| All hours (MAPE) | 3.03% | 2.10% | 1.68% |
| Median hourly error | 2.24% | 1.53% | 1.16% |
| Excluding 11 days where the plan looks broken | 2.90% | 2.07% | 1.65% |
| 2022 | 2.81% | 2.16% | 1.76% |
| 2023 | 2.85% | 1.99% | 1.66% |
| 2024 | 3.52% | 2.10% | 1.64% |
| 2025 | 3.07% | 1.98% | 1.57% |
| 2026 | 2.82% | 2.31% | 1.82% |
On this data the model had a lower error than the official plan even without temperature, and was more accurate on 71% of days. The result points the same way in each of the five years.
How sure is the forecast?
An interval is often more useful than a single number: “tomorrow at 14:00, consumption will be between these two values with 80 percent probability.” For this I trained the same model twice more, to predict the 10% and 90% quantiles. A good interval should contain 80% of the actual values.
| Day type | Raw interval | Adjusted with past errors |
|---|---|---|
| Working day | 64.5% | 80.7% |
| Weekend | 67.9% | 81.4% |
| Public holiday | 69.5% | 77.3% |
| Eve of a religious holiday | 52.1% | 58.8% |
| Religious holiday | 66.9% | 72.5% |
| All | 65.5% | 80.6% |
The raw interval came out too narrow: only 65% of the actual values fell inside. The model is more confident than it should be. To correct this, each month I widened the interval using the test errors of the previous twelve months (a conformal method). Coverage rose to 81%; the mean width of the interval is 5.6% of consumption.
The correction fixes the average but not every day type: on holiday eves coverage is 59%. The days on which the model is most wrong are the days on which it knows least that it might be.
The days the model got most wrong
| Day | Day's error (MAPE) | Forecast vs actual | What happened? |
|---|---|---|---|
| 26 Jan 2022 | 15.4% | 15% higher | Planned power cuts to industry |
| 25 Jan 2022 | 14.6% | 15% higher | Planned power cuts to industry |
| 1 May 2022 | 14.2% | 14% higher | Eve of Ramadan Feast and May 1 on the same day |
| 7 Feb 2023 | 12.4% | 12% higher | Kahramanmaraş earthquakes |
| 5 May 2022 | 11.6% | 11% higher | Working day bridging the holiday to the weekend |
| 26 May 2026 | 10.9% | 11% higher | Administrative leave before the holiday (eve) |
| 6 Feb 2023 | 10.5% | 11% higher | Kahramanmaraş earthquakes |
| 24 Jan 2022 | 9.9% | 10% higher | Planned power cuts to industry |
| 25 May 2026 | 9.6% | 10% higher | Administrative leave before the holiday |
On all nine of the worst days the model forecast consumption too high, and they fall into three groups:
- Unforeseeable events. The planned power cuts to industry during the natural gas shortage of January 2022, and the earthquakes of February 2023. No model that looks at past consumption can know these in advance.
- Holidays that are not in the calendar. When a religious holiday is extended to nine days by administrative leave, the working days in between become holidays in practice. The calendar I used does not contain them.
- Overlapping holidays. May 1, 2022 was both a holiday eve and a public holiday; the data had never contained such a day before.
The second group can be fixed: administrative leave is usually announced weeks ahead and can be added to the calendar by hand. That is the first improvement to make.
Limitations
Conclusion
Most of a good demand forecast came not from the choice of model but from three things: setting the target correctly (a ratio to the last week instead of megawatts), giving the calendar to the model explicitly, and testing the model the way it will be used, each day with only what was known up to that day.
The mean error is not a good summary. The model is off by less than 2% on most days; the real risk is concentrated in a few days a year, and most of those are about the calendar. For someone using the forecast, a more useful question than “what is the average error” is “on which days should I not trust it”.
Data: EPİAŞ Transparency Platform (real-time consumption and load forecast plan), Open-Meteo (temperature). Test period January 1, 2022 – September 30, 2026.