This is the code that I had

    def train(net, loss_fn, train_data, epochs, batch_size):
    train_acc= metric.Accuracy()
    trainer= gluon.Trainer(net.collect_params(),
                           'sgd',{'learning_rate': 0.1})

    for epoch in range(2):

        train_loss = 0

        

        for data, label in train_data:

            with autograd.record():

                output = net(data)

                loss = loss_fn(output, label)

            loss.backward()
    

            trainer.step(batch_size)

            

            train_loss += loss.mean().asscalar()

            train_acc.update(label, output)

            print("Epoch [%d] Loss:%.3f Acc:%.3f"%(
                epoch, train_loss/len(train_data), 
                train_acc.get()[1]))
    

    net.save_parameters('trained_net.params')

    return train_data, train_acc.get()[1]
    

We are supposed to train for 5 epochs and achieve an accuracy of over 99%

    net, ta = train(*get_network(), train_data, 5, batch_size)

The image showed that the accuracy has topped off at 98.8%, which obviously 
failed to surpass 99%. Plus, the training stopped at epoch[2] instead of 
epoch[4]

![image|690x274](upload://779G8SLu17PAXfwZTOKYkqJSfgK.jpeg) 

I must have made an error somewhere, but failed to locate that error. Need 
someone to point out the error





---
[Visit 
Topic](https://discuss.mxnet.apache.org/t/i-fail-to-get-an-accuracy-of-more-than-99/6814/1)
 or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.mxnet.apache.org/email/unsubscribe/2912740b12772c3fb5ba80aba09c258d708ad587590e86f9fee14070f29d488d).

Reply via email to