-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RNN classification example #19
Comments
If I am right, you can replace kad_node_t *t;
int rnn_flag = KANN_RNN_VAR_H0;
if (norm) rnn_flag |= KANN_RNN_NORM;
t = kann_layer_input(28); // 28x28
for (i = 0; i < n_h_layers; ++i) {
t = kann_layer_gru(t, n_h_neurons, rnn_flag);
t = kann_layer_dropout(t, dropout);
}
// replace "t = kad_avg(1, &t);" with:
t = kad_select(1, &t, -1);
ann = kann_new(kann_layer_cost(t, 10, KANN_C_CEB), 0); |
When you use n_var = kann_size_var(ann);
r = (float*)calloc(n_var, sizeof(float));
x = (float**)malloc(d->ulen * sizeof(float*));
y = (float**)malloc(1 * sizeof(float*));
for (j = 0; j < d->ulen; ++j)
x[j] = (float*)calloc(mini_size * d->n_in, sizeof(float));
y[0] = (float*)calloc(mini_size * d->n_out, sizeof(float));
shuf = (int*)calloc(d->n, sizeof(int));
KANN only uses the first
Yes, indeed. I should add such an example at some point... |
Thank you for clarifying. I changed a little bit
Both previous and current implementations produce exactly the same mnist-rnn.kan file. I also tried
|
Thanks a lot for the confirmation. Do you mind if I modify your code a little bit and add to the "examples/" directory? I will say something like "Code was written by Oleg Mazko (@mazko) and modified by Attractive Chaos". Is that ok? |
Of course it's ok. There is also a project https://github.com/42io/c_keyword_spotting which is based on kann. I am planing to add rnn there too in a couple weeks or so. |
Have you finished this goal to applay GRU in Kann? @mazko |
When classify a sequence, we would like the network to have one output, instead of a sequence of output. According to 01user.md to classify a sequence
kad_avg
was mentioned. I tried this on mnist. It works buti am not sure how to train such network. During training process we don't even know output values other then last one. In this line
memcpy(&y[k][b * d->n_out], d->y[s], d->n_out * sizeof(float));
eachy
in sequence of output has same valued->y[s]
which looks strange.It would be great to see any simple rnn classification example.
The text was updated successfully, but these errors were encountered: