CiaburroGiuseppe / Neural-Networks-with-R

MIT License
1 stars 0 forks source link

Questions about the example in the book: Neural-Networks-with-R #1

Open Junedays opened 4 years ago

Junedays commented 4 years ago

This is a nice book and i really learned a lot from it.

I am a little bit confused by the following codes of the Chapter 6, Humidity forecasting with RNNs

model <- trainr(Y = Y[train,], X = Y[train,], learningrate = 0.05, hidden_dim = 16, numepochs = 1000)

I am confused because in this line of code, the Y= and X= were using the same data matrix: Y[train,]. Should we use the input matrix for the X= in the trainr?

Additionally, when you validate the model, you used

Yp <- predictr(model, Y[test,])

Should we use Yp <- predictr(model, X[test,]) ? X[test,] is the input of the test dataset, and we need to use the model to predict the y , based on the input of x in the test dataset.

I think the other example codes of rnn in page 281 to 282 [model based on X1+X2 to predict Y and validate on A1+A2 to predict B] is correct

CiaburroGiuseppe commented 4 years ago

First of all, thank you for purchasing my book. I am very pleased that you have appreciated my work, for an author the satisfaction of his readers represents an important incentive to continue. What you reported is not a problem, in fact the function code and produces an output, but I understand that you can be confused. In this case we treat a time series and our aim is to predict the daily trend of humidity as a function of a trend already known because measured. This means that X represents the measured data, that is, what we have, but Y also represents such data. In fact, our aim is to reconstruct this trend. This is not a regression problem in which, starting from predictors (X), we predict the response of the system (Y). The other case you reported represents an application of the recurrent neural networks to a regression case, which is why you understood its application. I hope I've been sufficiently clear. Otherwise feel free to rewrite me.

CiaburroGiuseppe commented 4 years ago

First of all, thank you for purchasing my book. I am very pleased that you have appreciated my work, for an author the satisfaction of his readers represents an important incentive to continue. What you reported is not a problem, in fact the function code and produces an output, but I understand that you can be confused. In this case we treat a time series and our aim is to predict the daily trend of humidity as a function of a trend already known because measured. This means that X represents the measured data, that is, what we have, but Y also represents such data. In fact, our aim is to reconstruct this trend. This is not a regression problem in which, starting from predictors (X), we predict the response of the system (Y). The other case you reported represents an application of the recurrent neural networks to a regression case, which is why you understood its application. I hope I've been sufficiently clear. Otherwise feel free to rewrite me.

Best regards.

On Tue, May 5, 2020 at 5:47 AM Junedays notifications@github.com wrote:

This is a nice book and i really learned a lot from it.

I am a little bit confused by the following codes of the Chapter 6, Humidity forecasting with RNNs

model <- trainr(Y = Y[train,], X = Y[train,], learningrate = 0.05, hidden_dim = 16, numepochs = 1000)

I am confused because in this line of code, the Y= and X= were using the same data matrix: Y[train,]. Should we use the input matrix for the X= in the trainr?

Additionally, when you validate the model, you used

Yp <- predictr(model, Y[test,])

Should we use Yp <- predictr(model, X[test,]) ? X[test,] is the input of the test dataset, and we need to use the model to predict the y , based on the input of x in the test dataset.

I think the other example codes of rnn in page 281 to 282 [model based on X1+X2 to predict Y and validate on A1+A2 to predict B] is correct

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CiaburroGiuseppe/Neural-Networks-with-R/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWN54TDCAUTXCCF7QDCK63RP6D53ANCNFSM4MZHXOOQ .

Junedays commented 4 years ago

Thank you for you timely responses. I now understand the differences between the two cases now. In the humidity case, you are actually depicting an already measured trend, and use this trend to predict the future humidity.

And i have another question now , still for the humidity predicting case.

In your model training, as well as the model validation code:

model <- trainr(Y = Y[train,], X = Y[train,],learningrate = 0.05, hidden_dim = 16, numepochs = 1000)

Yp <- predictr(model, Y[test,])

There seems to have no place for the input of the date information : X=matrix(x,nrow=30)

I think that the date information is very important to delineate the trend Y(humidity), e.g. if a humidity changed from 18 to 88 in 3 months is different from that in 3 years. But i cannot see any places where you incorporated the date information: X=matrix(x,nrow=30).