Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

NN en R.R 873 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  1. # Importando los datos
  2. library(readr)
  3. APTelectric <- read_csv("A CURSO SERIES TEMPORALES (NUEVO)/Clases Nuevas/Redes Neuronales para series/Clase 9/APTelectricity.csv",
  4. col_types = cols(X1 = col_skip()))
  5. # Objeto ts
  6. myts = ts(APTelectric$watt, frequency = 288)
  7. plot(myts)
  8. # Ajuste del modelo
  9. library(forecast)
  10. fit = nnetar(myts)
  11. # Predicciones
  12. nnetforecast <- forecast(fit, h = 400, PI = F)
  13. library(ggplot2)
  14. autoplot(nnetforecast)
  15. # Usando una variable exógena
  16. fit2 = nnetar(myts, xreg = APTelectric$appliances)
  17. # Definiendo los pronósticos de la variable exógena para 10 horas
  18. y =rep(2, times = 12*10)
  19. nnetforecast <- forecast(fit2, xreg = y, PI = F)
  20. autoplot(nnetforecast)
  21. # Definiendo los pronósticos de la variable exógena para 30 horas
  22. y =rep(2, times = 12*30)
  23. nnetforecast <- forecast(fit2, xreg = y, PI = F)
  24. autoplot(nnetforecast)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...