0

I'm getting started with R, I really like it but recently I found myself in a corner. I'd like to build neural network model that predicts heat consumption. I have historical data that contains outside air temperature (model input) and heat demand values (model output) in megawatts (hourly data from past 4 years). I would like to use my model to predict heat demand for 24h ahead based on air temperature weather forecast (also 24 hours ahead). Here is my code:

data <- read.delim("C:/.../data.csv", dec=",")
require(neuralnet)
trainset<-data[1:26208,]
testset<-data[26209:26232,]
net<-neuralnet(heat~temp,trainset,hidden=5,threshold=0.01)

.. and I get error that 'algorithm did not converge'

This is my first attempt to build model. That's why I want to use only one input parameter (air temperature), In the future, I would like to use few more inputs like wind speed, info about working days and holidays and so on. Do you have any idea what I did wrong? Is it the problem with number of hidden neurons or layers? I also tried to use other values of parameter 'hidden' and I still got errors.

Here is my dataset: click

Thank you in advance for your help.

  • possible duplicate of [R neuralnet does not converge within stepmax for time series](http://stackoverflow.com/questions/16631065/r-neuralnet-does-not-converge-within-stepmax-for-time-series) – duffymo Apr 09 '14 at 11:42
  • This might help you as well. Convergence has to do with understanding both the algorithm and your data: http://journal.r-project.org/archive/2010-1/RJournal_2010-1_Guenther+Fritsch.pdf – duffymo Apr 09 '14 at 11:43

1 Answers1

0

Thank you for your comments. After reading materials provided with you I thought that

I tried once more with different neural net configuration and smaller datasets:

> trainset<-data[1:1000,]
> testset<-data[1001:1024,]
> net<-neuralnet(heat~temp,trainset,hidden=2,threshold=0.01)
> temp_test<-subset(testset,select=temp)
> net.results<-compute(net,temp_test)
> results<-data.frame(actual=testset$heat,prediction=net.results$net.result)
> View(results)

So I assume that my problem with convergence is caused by relation betweet model configuration (number of hidden neurons) and number of training dataset observations.