Skip to content
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

Deep Neural Network / Dropout regularization with gluon #527

Open
theoneandonlywoj opened this issue Aug 15, 2018 · 0 comments
Open

Deep Neural Network / Dropout regularization with gluon #527

theoneandonlywoj opened this issue Aug 15, 2018 · 0 comments

Comments

@theoneandonlywoj
Copy link

theoneandonlywoj commented Aug 15, 2018

In the notebook, I noticed that the accuracy is calculated as follows:

def evaluate_accuracy(data_iterator, net):
    acc = mx.metric.Accuracy()
    for i, (data, label) in enumerate(data_iterator):
        data = data.as_in_context(ctx).reshape((-1, 784))
        label = label.as_in_context(ctx)
        output = net(data)
        predictions = nd.argmax(output, axis=1)
        acc.update(preds=predictions, labels=label)
    return acc.get()[1]

I am little confused as I think during the training the test (or validation) accuracy is evaluated as if the dropout was still 0.5.
I can understand simplification for the training purposes, but shouldn't the training accuracy be evaluated with the dropout and the validation and test accuracy values be 0?
Would solution to that be additional parameter include_dropoutas below:

def evaluate_accuracy(data_iterator, net, include_dropout=True):
    acc = mx.metric.Accuracy()
    with autograd.record(train_mode=include_dropout):
        for i, (data, label) in enumerate(data_iterator):
            data = data.as_in_context(ctx).reshape((-1, 784))
            label = label.as_in_context(ctx)
            output = net(data)
            predictions = nd.argmax(output, axis=1)
            acc.update(preds=predictions, labels=label)
    return acc.get()[1]

Regards

Wojciech

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant