# How to decrease accuracy from 99% to 80%~85% using keras for training a model

How do I decrease the accuracy value when training a model using Keras; which parameters can I change to decrease the value?

My objective is not to actually decrease it, but just to know which parameters influence the accuracy

sgd = optimizers.SGD(lr=1e-2)

• You give like no information here! It's like you're saying "Hey I have a code. Where is my bug?" without giving the code. First of all: What model? There are so many models with so many types of parameters that this is impossible to answer specific to your problem. Second: What data do you have? Thirdly: Why would you want to decrease accuracy? Is this about overfitting? – Andreas Storvik Strauman May 24 '18 at 16:16
• Well not impossible per se. You COULD just take the accuracy=accuracy-13 which would, technically, give the correct response. – Andreas Storvik Strauman May 24 '18 at 16:18
• This question should be migrated to: datascience.stackexchange.com. – JahKnows Jun 1 '18 at 8:46

There are many things affecting accuracy. I'm gonna assume a lot here because you don't say anything about the model, what you're trying to achieve or how many classes you have. You're not even saying whether you're classifying or not. Also, you're not saying which accuracy you're using (classification, AUC, F1 etc.).

I'm gonna assume here that you have some classification problem.

Accuracy is the measure of how many classifications you got correct. In my experience 99% is a warning sign because it's too good to be true, and a result like that is often due to overfitting. Since this, in my experience, is the main reason you'd actually want the accuracy down, this is what I'm going to assume is your problem.

Overfitting occurs when you train "too much" and the model only learns things that are within your training set, and fails on everything else. That is: it generalized bad.

To prevent this there are a number of things you could do;

1) Data segmentation

The most common is to split your data into three bulks: training (~70% of the data), validation(~20%) test (~10%). These percentages are indications and would vary depending on how much data you have, and the balancing.

The idea is that you train on the training data, you run the validation through the network, and calculate the accuracy. When this accuracy, call it validation accuracy, is satisfactory, then you stop the training and run the test data through it. The latter accuracy (test accuracy) is the one that most papers publish (combined with AUC and F1 score.

Important: When you have split the data into these bulks you should put away the test, and not use it during training at all. You only use this at the very end to do an extra check that you haven't overfitted.

2) Regularization There are many types of regularization. Two very popular regularization methods for preventing overfitting are the L2-regularization (see previous link) and the dropout methods.

Without going into detail, these methods prevent the model weights from becoming too large. This is a good thing since the model won't rely too much on one feature, which in turn attenuates overfitting.

I hope you learned something, and the most important lesson is that you should know what you're doing. If not, you could end up with a model that is not behaving like you thought. In the case of overfitting, you'd end up with a model that only works on your training data, which doesn't really do much good.

I really recommend the book by Goodfellow: deeplearningbook.org.