library(prophet)
df <- read.csv('../input/electricity-france/electricity_france.csv')
df
Loading required package: Rcpp

Loading required package: rlang

A data.frame: 1442 × 7
DateActivePowerReactivePowerVoltageKitchenLaundryHVAC
<fct><dbl><dbl><dbl><int><int><int>
2006-12-161209.176 34.922236.2438 0 546 4926
2006-12-173390.460226.006240.08702033418713341
2006-12-182203.826161.792241.23171063262114018
2006-12-191666.194150.942241.9993 8397602 6197
2006-12-202225.748160.998242.3081 0264814063
2006-12-211716.624144.166241.04051765262310421
2006-12-222341.338186.906241.18453151 35011131
2006-12-234773.386221.470240.13612669 42514726
2006-12-242550.012149.900241.687417035082 6891
2006-12-252743.120240.280243.399966201962 5795
2006-12-263934.110165.102241.62541086253314979
2006-12-271528.760178.902243.7674 0 314 6976
2006-12-282072.638208.876243.268322074419 9176
2006-12-293174.392196.394240.87131252516211329
2006-12-302789.302311.928240.54073072789112480
2006-12-313494.196150.852239.8966 0 347 6502
2007-01-012749.004148.166240.1290 0 352 5880
2007-01-021269.236190.342241.9438 0 348 6562
2007-01-031014.054196.728243.5571 0 344 4765
2007-01-043259.412202.302239.75031051759710896
2007-01-052713.364173.154240.49581483 379 7602
2007-01-061508.378192.188239.67311336 402 5678
2007-01-072447.620246.074240.90251987817712810
2007-01-082241.360207.568239.5770 0 46717547
2007-01-091869.054207.248240.487516884267 9790
2007-01-102154.800228.452241.0275 771445611012
2007-01-112255.194230.020241.15571378217012415
2007-01-121461.296199.140241.5382 0 439 8276
2007-01-133186.814290.736239.28367806297511341
2007-01-143007.816227.120238.82181777421512975
2010-10-281463.326187.240246.25391103 2627 9087
2010-10-291204.422195.720245.74311075 726 3911
2010-10-302152.700195.320243.26742353 61415303
2010-10-311476.430208.082245.49531430 678 5589
2010-11-011383.180187.086246.3796 0 634 8746
2010-11-021191.082186.520245.7869 0 574 5784
2010-11-031293.298176.264244.27851021 1108 6529
2010-11-042555.146252.438243.152260291119310286
2010-11-051736.088180.498243.7750 0 79012610
2010-11-061805.408193.958238.43023255 680 9803
2010-11-071673.816174.976238.43651026 621 6943
2010-11-081825.540145.656237.74311087 55513038
2010-11-092022.098154.670237.78812097 58312500
2010-11-101946.534153.472239.08481026 585813308
2010-11-111773.592152.188238.72873424 2216 6259
2010-11-121836.822151.144238.83792054 48910308
2010-11-132023.174162.180239.33271051 58913853
2010-11-142038.392203.694239.27985344 549 8758
2010-11-151747.382126.716239.54921075 4222 8918
2010-11-161509.748133.598241.1976 0 478 7949
2010-11-171582.032141.916241.45221153 491 8915
2010-11-181652.152206.196241.01682175 489 9449
2010-11-191570.400122.928240.0468 0 48311914
2010-11-202197.006153.768240.60834367 294711433
2010-11-21 900.910119.624241.1802 0 506 4778
2010-11-222041.536142.354240.19714855 211010136
2010-11-231577.536137.450240.57551871 458 7611
2010-11-241796.248132.460240.03101096 284812224
2010-11-251431.164116.128241.53631076 426 5072
2010-11-261488.104120.826240.29101080 385 9989
names(df) <- c("ds","y","","","","","")
df
A data.frame: 1442 × 7
dsy
<fct><dbl><dbl><dbl><int><int><int>
2006-12-161209.176 34.922236.2438 0 546 4926
2006-12-173390.460226.006240.08702033418713341
2006-12-182203.826161.792241.23171063262114018
2006-12-191666.194150.942241.9993 8397602 6197
2006-12-202225.748160.998242.3081 0264814063
2006-12-211716.624144.166241.04051765262310421
2006-12-222341.338186.906241.18453151 35011131
2006-12-234773.386221.470240.13612669 42514726
2006-12-242550.012149.900241.687417035082 6891
2006-12-252743.120240.280243.399966201962 5795
2006-12-263934.110165.102241.62541086253314979
2006-12-271528.760178.902243.7674 0 314 6976
2006-12-282072.638208.876243.268322074419 9176
2006-12-293174.392196.394240.87131252516211329
2006-12-302789.302311.928240.54073072789112480
2006-12-313494.196150.852239.8966 0 347 6502
2007-01-012749.004148.166240.1290 0 352 5880
2007-01-021269.236190.342241.9438 0 348 6562
2007-01-031014.054196.728243.5571 0 344 4765
2007-01-043259.412202.302239.75031051759710896
2007-01-052713.364173.154240.49581483 379 7602
2007-01-061508.378192.188239.67311336 402 5678
2007-01-072447.620246.074240.90251987817712810
2007-01-082241.360207.568239.5770 0 46717547
2007-01-091869.054207.248240.487516884267 9790
2007-01-102154.800228.452241.0275 771445611012
2007-01-112255.194230.020241.15571378217012415
2007-01-121461.296199.140241.5382 0 439 8276
2007-01-133186.814290.736239.28367806297511341
2007-01-143007.816227.120238.82181777421512975
2010-10-281463.326187.240246.25391103 2627 9087
2010-10-291204.422195.720245.74311075 726 3911
2010-10-302152.700195.320243.26742353 61415303
2010-10-311476.430208.082245.49531430 678 5589
2010-11-011383.180187.086246.3796 0 634 8746
2010-11-021191.082186.520245.7869 0 574 5784
2010-11-031293.298176.264244.27851021 1108 6529
2010-11-042555.146252.438243.152260291119310286
2010-11-051736.088180.498243.7750 0 79012610
2010-11-061805.408193.958238.43023255 680 9803
2010-11-071673.816174.976238.43651026 621 6943
2010-11-081825.540145.656237.74311087 55513038
2010-11-092022.098154.670237.78812097 58312500
2010-11-101946.534153.472239.08481026 585813308
2010-11-111773.592152.188238.72873424 2216 6259
2010-11-121836.822151.144238.83792054 48910308
2010-11-132023.174162.180239.33271051 58913853
2010-11-142038.392203.694239.27985344 549 8758
2010-11-151747.382126.716239.54921075 4222 8918
2010-11-161509.748133.598241.1976 0 478 7949
2010-11-171582.032141.916241.45221153 491 8915
2010-11-181652.152206.196241.01682175 489 9449
2010-11-191570.400122.928240.0468 0 48311914
2010-11-202197.006153.768240.60834367 294711433
2010-11-21 900.910119.624241.1802 0 506 4778
2010-11-222041.536142.354240.19714855 211010136
2010-11-231577.536137.450240.57551871 458 7611
2010-11-241796.248132.460240.03101096 284812224
2010-11-251431.164116.128241.53631076 426 5072
2010-11-261488.104120.826240.29101080 385 9989
df1 <- df[ -c(3:7) ]
df1
A data.frame: 1442 × 2
dsy
<fct><dbl>
2006-12-161209.176
2006-12-173390.460
2006-12-182203.826
2006-12-191666.194
2006-12-202225.748
2006-12-211716.624
2006-12-222341.338
2006-12-234773.386
2006-12-242550.012
2006-12-252743.120
2006-12-263934.110
2006-12-271528.760
2006-12-282072.638
2006-12-293174.392
2006-12-302789.302
2006-12-313494.196
2007-01-012749.004
2007-01-021269.236
2007-01-031014.054
2007-01-043259.412
2007-01-052713.364
2007-01-061508.378
2007-01-072447.620
2007-01-082241.360
2007-01-091869.054
2007-01-102154.800
2007-01-112255.194
2007-01-121461.296
2007-01-133186.814
2007-01-143007.816
2010-10-281463.326
2010-10-291204.422
2010-10-302152.700
2010-10-311476.430
2010-11-011383.180
2010-11-021191.082
2010-11-031293.298
2010-11-042555.146
2010-11-051736.088
2010-11-061805.408
2010-11-071673.816
2010-11-081825.540
2010-11-092022.098
2010-11-101946.534
2010-11-111773.592
2010-11-121836.822
2010-11-132023.174
2010-11-142038.392
2010-11-151747.382
2010-11-161509.748
2010-11-171582.032
2010-11-181652.152
2010-11-191570.400
2010-11-202197.006
2010-11-21 900.910
2010-11-222041.536
2010-11-231577.536
2010-11-241796.248
2010-11-251431.164
2010-11-261488.104
m <- prophet(df1)
Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.

future <- make_future_dataframe(m, periods = 365)
tail(future)
A data.frame: 6 × 1
ds
<dttm>
18022011-11-21
18032011-11-22
18042011-11-23
18052011-11-24
18062011-11-25
18072011-11-26
forecast <- predict(m, future)
tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
A data.frame: 6 × 4
dsyhatyhat_loweryhat_upper
<dttm><dbl><dbl><dbl>
18022011-11-211864.7621296.4952413.283
18032011-11-221977.2961420.6202541.178
18042011-11-231994.2841469.6362594.910
18052011-11-241849.2161330.3492419.845
18062011-11-251944.1871346.4822508.746
18072011-11-262194.8081630.2172723.581
plot(m, forecast)
prophet_plot_components(m, forecast)
plot(m, forecast) + add_changepoints_to_plot(m)
m <- prophet(df1, changepoint.prior.scale = 0.5)
forecast <- predict(m, future)
plot(m, forecast)
Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.

Download notebook

(1 download)

Post categories:

facebook prophet

r