I get the following error with rnn function: Error in x %*% model$time_synapse[[i]] : requires...
I'm trying to train a recurrent neural network on R with package 'rnn'. I tried to implement one as follows:
Y <- matrix(df_train$Y, nrow=48)
X <- matrix(df_train$insolvency, nrow=48)
It worked perfectly. However when I try to implement a network with X as an array combining 2 variables:
X <- array(c(df_train$insolvency, df_train$comportement), dim=c(48, 44,2))
I get the following error:
Error in x %*% model$time_synapse[[i]] : requires numeric/complex matrix/vector arguments
However both my variables insolvency and comportement are numeric, with no NA... Do you know where it could come from? I've read that this error message pops when you have character variable. It isn't the case here...
Example of data:
insolvency comportement Y
0.0019 0.000000e+00 2
0.0015 0.000000e+00 2
0.0015 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 2.981289e-02 0
0.0016 2.279081e-03 0
0.0016 5.357894e-03 0
0.0016 4.559373e-01 0
0.0019 3.636734e-01 0
0.0019 3.728338e-01 0
0.0049 4.239274e-01 0
0.0025 4.581197e-01 0
0.0049 1.072687e-01 0
0.0049 2.978970e-03 0
0.0037 0.000000e+00 0
0.0049 1.122552e-01 0
0.0049 1.257744e-01 0
0.0031 3.107757e-02 0
0.0031 3.312815e-02 0
0.0031 0.000000e+00 0
0.0025 6.843268e-02 0
0.0025 1.151147e-01 0
0.0025 1.329283e-01 0
0.0025 7.341950e-02 0
0.0031 0.000000e+00 0
0.0031 0.000000e+00 0
0.0031 8.637882e-02 0
0.0031 0.000000e+00 0
0.0025 0.000000e+00 0
Here is the code I wrote that fails when trying to implement rnn:
nnet <- trainr(Y=Y, X=X, learningrate=0.05, hidden_dim = 16, numepochs = 250)
arrays r rnn
add a comment |
I'm trying to train a recurrent neural network on R with package 'rnn'. I tried to implement one as follows:
Y <- matrix(df_train$Y, nrow=48)
X <- matrix(df_train$insolvency, nrow=48)
It worked perfectly. However when I try to implement a network with X as an array combining 2 variables:
X <- array(c(df_train$insolvency, df_train$comportement), dim=c(48, 44,2))
I get the following error:
Error in x %*% model$time_synapse[[i]] : requires numeric/complex matrix/vector arguments
However both my variables insolvency and comportement are numeric, with no NA... Do you know where it could come from? I've read that this error message pops when you have character variable. It isn't the case here...
Example of data:
insolvency comportement Y
0.0019 0.000000e+00 2
0.0015 0.000000e+00 2
0.0015 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 2.981289e-02 0
0.0016 2.279081e-03 0
0.0016 5.357894e-03 0
0.0016 4.559373e-01 0
0.0019 3.636734e-01 0
0.0019 3.728338e-01 0
0.0049 4.239274e-01 0
0.0025 4.581197e-01 0
0.0049 1.072687e-01 0
0.0049 2.978970e-03 0
0.0037 0.000000e+00 0
0.0049 1.122552e-01 0
0.0049 1.257744e-01 0
0.0031 3.107757e-02 0
0.0031 3.312815e-02 0
0.0031 0.000000e+00 0
0.0025 6.843268e-02 0
0.0025 1.151147e-01 0
0.0025 1.329283e-01 0
0.0025 7.341950e-02 0
0.0031 0.000000e+00 0
0.0031 0.000000e+00 0
0.0031 8.637882e-02 0
0.0031 0.000000e+00 0
0.0025 0.000000e+00 0
Here is the code I wrote that fails when trying to implement rnn:
nnet <- trainr(Y=Y, X=X, learningrate=0.05, hidden_dim = 16, numepochs = 250)
arrays r rnn
I don't understand what you are trying to do there with the array. Just use cbind to combine both vectors into a matrix.
– Roland
Nov 21 '18 at 10:07
Thank you it works... I still don't understand why I had this error message
– T. Ciffréo
Nov 21 '18 at 10:15
Well, I'm guessing here but I don't think the documentation says that a 3d array is acceptable input.
– Roland
Nov 21 '18 at 10:46
Actually documentation says that X must be a 3D array (dim 1: sample, dim 2: time, dim 3: variables)
– T. Ciffréo
Nov 21 '18 at 12:40
add a comment |
I'm trying to train a recurrent neural network on R with package 'rnn'. I tried to implement one as follows:
Y <- matrix(df_train$Y, nrow=48)
X <- matrix(df_train$insolvency, nrow=48)
It worked perfectly. However when I try to implement a network with X as an array combining 2 variables:
X <- array(c(df_train$insolvency, df_train$comportement), dim=c(48, 44,2))
I get the following error:
Error in x %*% model$time_synapse[[i]] : requires numeric/complex matrix/vector arguments
However both my variables insolvency and comportement are numeric, with no NA... Do you know where it could come from? I've read that this error message pops when you have character variable. It isn't the case here...
Example of data:
insolvency comportement Y
0.0019 0.000000e+00 2
0.0015 0.000000e+00 2
0.0015 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 2.981289e-02 0
0.0016 2.279081e-03 0
0.0016 5.357894e-03 0
0.0016 4.559373e-01 0
0.0019 3.636734e-01 0
0.0019 3.728338e-01 0
0.0049 4.239274e-01 0
0.0025 4.581197e-01 0
0.0049 1.072687e-01 0
0.0049 2.978970e-03 0
0.0037 0.000000e+00 0
0.0049 1.122552e-01 0
0.0049 1.257744e-01 0
0.0031 3.107757e-02 0
0.0031 3.312815e-02 0
0.0031 0.000000e+00 0
0.0025 6.843268e-02 0
0.0025 1.151147e-01 0
0.0025 1.329283e-01 0
0.0025 7.341950e-02 0
0.0031 0.000000e+00 0
0.0031 0.000000e+00 0
0.0031 8.637882e-02 0
0.0031 0.000000e+00 0
0.0025 0.000000e+00 0
Here is the code I wrote that fails when trying to implement rnn:
nnet <- trainr(Y=Y, X=X, learningrate=0.05, hidden_dim = 16, numepochs = 250)
arrays r rnn
I'm trying to train a recurrent neural network on R with package 'rnn'. I tried to implement one as follows:
Y <- matrix(df_train$Y, nrow=48)
X <- matrix(df_train$insolvency, nrow=48)
It worked perfectly. However when I try to implement a network with X as an array combining 2 variables:
X <- array(c(df_train$insolvency, df_train$comportement), dim=c(48, 44,2))
I get the following error:
Error in x %*% model$time_synapse[[i]] : requires numeric/complex matrix/vector arguments
However both my variables insolvency and comportement are numeric, with no NA... Do you know where it could come from? I've read that this error message pops when you have character variable. It isn't the case here...
Example of data:
insolvency comportement Y
0.0019 0.000000e+00 2
0.0015 0.000000e+00 2
0.0015 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 0.000000e+00 0
0.0016 2.981289e-02 0
0.0016 2.279081e-03 0
0.0016 5.357894e-03 0
0.0016 4.559373e-01 0
0.0019 3.636734e-01 0
0.0019 3.728338e-01 0
0.0049 4.239274e-01 0
0.0025 4.581197e-01 0
0.0049 1.072687e-01 0
0.0049 2.978970e-03 0
0.0037 0.000000e+00 0
0.0049 1.122552e-01 0
0.0049 1.257744e-01 0
0.0031 3.107757e-02 0
0.0031 3.312815e-02 0
0.0031 0.000000e+00 0
0.0025 6.843268e-02 0
0.0025 1.151147e-01 0
0.0025 1.329283e-01 0
0.0025 7.341950e-02 0
0.0031 0.000000e+00 0
0.0031 0.000000e+00 0
0.0031 8.637882e-02 0
0.0031 0.000000e+00 0
0.0025 0.000000e+00 0
Here is the code I wrote that fails when trying to implement rnn:
nnet <- trainr(Y=Y, X=X, learningrate=0.05, hidden_dim = 16, numepochs = 250)
arrays r rnn
arrays r rnn
asked Nov 21 '18 at 10:01
T. CiffréoT. Ciffréo
648
648
I don't understand what you are trying to do there with the array. Just use cbind to combine both vectors into a matrix.
– Roland
Nov 21 '18 at 10:07
Thank you it works... I still don't understand why I had this error message
– T. Ciffréo
Nov 21 '18 at 10:15
Well, I'm guessing here but I don't think the documentation says that a 3d array is acceptable input.
– Roland
Nov 21 '18 at 10:46
Actually documentation says that X must be a 3D array (dim 1: sample, dim 2: time, dim 3: variables)
– T. Ciffréo
Nov 21 '18 at 12:40
add a comment |
I don't understand what you are trying to do there with the array. Just use cbind to combine both vectors into a matrix.
– Roland
Nov 21 '18 at 10:07
Thank you it works... I still don't understand why I had this error message
– T. Ciffréo
Nov 21 '18 at 10:15
Well, I'm guessing here but I don't think the documentation says that a 3d array is acceptable input.
– Roland
Nov 21 '18 at 10:46
Actually documentation says that X must be a 3D array (dim 1: sample, dim 2: time, dim 3: variables)
– T. Ciffréo
Nov 21 '18 at 12:40
I don't understand what you are trying to do there with the array. Just use cbind to combine both vectors into a matrix.
– Roland
Nov 21 '18 at 10:07
I don't understand what you are trying to do there with the array. Just use cbind to combine both vectors into a matrix.
– Roland
Nov 21 '18 at 10:07
Thank you it works... I still don't understand why I had this error message
– T. Ciffréo
Nov 21 '18 at 10:15
Thank you it works... I still don't understand why I had this error message
– T. Ciffréo
Nov 21 '18 at 10:15
Well, I'm guessing here but I don't think the documentation says that a 3d array is acceptable input.
– Roland
Nov 21 '18 at 10:46
Well, I'm guessing here but I don't think the documentation says that a 3d array is acceptable input.
– Roland
Nov 21 '18 at 10:46
Actually documentation says that X must be a 3D array (dim 1: sample, dim 2: time, dim 3: variables)
– T. Ciffréo
Nov 21 '18 at 12:40
Actually documentation says that X must be a 3D array (dim 1: sample, dim 2: time, dim 3: variables)
– T. Ciffréo
Nov 21 '18 at 12:40
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409519%2fi-get-the-following-error-with-rnn-function-error-in-x-modeltime-synapse%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409519%2fi-get-the-following-error-with-rnn-function-error-in-x-modeltime-synapse%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't understand what you are trying to do there with the array. Just use cbind to combine both vectors into a matrix.
– Roland
Nov 21 '18 at 10:07
Thank you it works... I still don't understand why I had this error message
– T. Ciffréo
Nov 21 '18 at 10:15
Well, I'm guessing here but I don't think the documentation says that a 3d array is acceptable input.
– Roland
Nov 21 '18 at 10:46
Actually documentation says that X must be a 3D array (dim 1: sample, dim 2: time, dim 3: variables)
– T. Ciffréo
Nov 21 '18 at 12:40