I am training a dataset with age in humans and when I run model\'s compile metri
ID: 3734438 • Letter: I
Question
I am training a dataset with age in humans and when I run model's compile metrics='accuracy', I don't want it to compute the exact accuracy, but just look for a certain age range and compute the accuracy if it correctly identifies the age range. I am wondering how I could do this. Can I simply edit the compile function?
So what I am starting with is <https://github.com/yu4u/age-gender-estimation>
What I am trying to do is to extract the age, check if it is in a certain range, say 20 - 30 and then determine the accuracy based on if the program is correct in seeing it is 20 - 30 as opposed to checking the accuracy if the program can recognize the exact age. What I thought would be easiest is to add a new metric to the model.compile function seen in lines 71-72 of the train.py file
model.compile(optimizer=sgd, loss=["categorical_crossentropy", "categorical_crossentropy"],
metrics=['accuracy'])
A problem I am having is I am not sure how to check the actual age from this file to plug it into the custom metric or even creating a callback
From here, I assume I would have to edit the plot_history.py file to actually plot the accuracy.
If anybody has any ideas, that would be a tremendous help
Thank you
Explanation / Answer
You can solve this in the following way, if you want to measure the accuracy for particular range then you can make the training data like i meant if the person's age is 0-10, you can give label 0, if it is 10-20 you can give label 2 and so on. And you can use this newly created column and treat this problem as classification problem. Doing this way is easiest way to compute accuracy based on range.