Additional loss / regularization term based on distance in classification of ordinal classes with neural networks Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsNeural networks: which cost function to use?Is cross-entropy a good cost function if I'm interested in the probabilities of a sample belonging to a certain class?Cost function for Ordinal Regression using neural networksFractions or probabilities as training labelsTheoretical and practical comparison of CTC and seq2seq loss in TensorflowNeural Networks - Strategies for problems with high Bayes error rateHow to use a cross entropy loss function for each letter/digit in a captcha?Dealing with extreme values in softmax cross entropy?What loss function avoids overconfidence?Loss Function for Probability Regression

Can this water damage be explained by lack of gutters and grading issues?

Suing a Police Officer Instead of the Police Department

Who's this lady in the war room?

"Destructive force" carried by a B-52?

How was Lagrange appointed professor of mathematics so early?

Output the slug and name of a CPT single post taxonomy term

What were wait-states, and why was it only an issue for PCs?

Kepler's 3rd law: ratios don't fit data

When does Bran Stark remember Jamie pushing him?

What is the definining line between a helicopter and a drone a person can ride in?

Marquee sign letters

How is an IPA symbol that lacks a name (e.g. ɲ) called?

Why aren't road bike wheels tiny?

Knights and Knaves question

2 sample t test for sample sizes - 30,000 and 150,000

Is it OK if I do not take the receipt in Germany?

A journey... into the MIND

Is "ein Herz wie das meine" an antiquated or colloquial use of the possesive pronoun?

Proving inequality for positive definite matrix

Is Vivien of the Wilds + Wilderness Reclamation a competitive combo?

Who can become a wight?

Why not use the yoke to control yaw, as well as pitch and roll?

Pointing to problems without suggesting solutions

Does Prince Arnaud cause someone holding the Princess to lose?



Additional loss / regularization term based on distance in classification of ordinal classes with neural networks



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsNeural networks: which cost function to use?Is cross-entropy a good cost function if I'm interested in the probabilities of a sample belonging to a certain class?Cost function for Ordinal Regression using neural networksFractions or probabilities as training labelsTheoretical and practical comparison of CTC and seq2seq loss in TensorflowNeural Networks - Strategies for problems with high Bayes error rateHow to use a cross entropy loss function for each letter/digit in a captcha?Dealing with extreme values in softmax cross entropy?What loss function avoids overconfidence?Loss Function for Probability Regression










0












$begingroup$


Sometimes when doing classification with neural networks, there is no ordinal relationship between the target classes. However, if there is, using cross-entropy loss for training, is there a way to add an extra regularization term or loss term that is based on the distance between the predicted class and target class? The goal is of course to give the model the intuition that it is worse to predict class 0 for target 25 than to predict class 24. I was also thinking along the lines of using mean squared error instead of cross-entropy as a loss function but maybe that's unusual for neural networks? Any thoughts or experiences regarding this?










share|improve this question









$endgroup$











  • $begingroup$
    How about treating it as a regression problem, if there is a clear mapping from the classes to scalar values? if your categories are like age ranges "18-24", "25-40", etc, then treat these as a scalar that's the midpoint of the range.
    $endgroup$
    – Sean Owen
    Apr 4 at 19:37










  • $begingroup$
    Makes sense but would that imply changing the architecture altogether, turning the problem into a regression problem instead of a classification problem? I think the problem might be that I have 96 classes and scaling them to be in [0, 1] would give a very dense population in that small interval... I feel like such a model wouldn't be successful in predicting the exact right value very often even though it would be successful in the way that it would often be in the vicinity of the right value... but maybe I am mistaken, I have done much more classification than regression.
    $endgroup$
    – fast-reflexes
    Apr 6 at 11:20















0












$begingroup$


Sometimes when doing classification with neural networks, there is no ordinal relationship between the target classes. However, if there is, using cross-entropy loss for training, is there a way to add an extra regularization term or loss term that is based on the distance between the predicted class and target class? The goal is of course to give the model the intuition that it is worse to predict class 0 for target 25 than to predict class 24. I was also thinking along the lines of using mean squared error instead of cross-entropy as a loss function but maybe that's unusual for neural networks? Any thoughts or experiences regarding this?










share|improve this question









$endgroup$











  • $begingroup$
    How about treating it as a regression problem, if there is a clear mapping from the classes to scalar values? if your categories are like age ranges "18-24", "25-40", etc, then treat these as a scalar that's the midpoint of the range.
    $endgroup$
    – Sean Owen
    Apr 4 at 19:37










  • $begingroup$
    Makes sense but would that imply changing the architecture altogether, turning the problem into a regression problem instead of a classification problem? I think the problem might be that I have 96 classes and scaling them to be in [0, 1] would give a very dense population in that small interval... I feel like such a model wouldn't be successful in predicting the exact right value very often even though it would be successful in the way that it would often be in the vicinity of the right value... but maybe I am mistaken, I have done much more classification than regression.
    $endgroup$
    – fast-reflexes
    Apr 6 at 11:20













0












0








0





$begingroup$


Sometimes when doing classification with neural networks, there is no ordinal relationship between the target classes. However, if there is, using cross-entropy loss for training, is there a way to add an extra regularization term or loss term that is based on the distance between the predicted class and target class? The goal is of course to give the model the intuition that it is worse to predict class 0 for target 25 than to predict class 24. I was also thinking along the lines of using mean squared error instead of cross-entropy as a loss function but maybe that's unusual for neural networks? Any thoughts or experiences regarding this?










share|improve this question









$endgroup$




Sometimes when doing classification with neural networks, there is no ordinal relationship between the target classes. However, if there is, using cross-entropy loss for training, is there a way to add an extra regularization term or loss term that is based on the distance between the predicted class and target class? The goal is of course to give the model the intuition that it is worse to predict class 0 for target 25 than to predict class 24. I was also thinking along the lines of using mean squared error instead of cross-entropy as a loss function but maybe that's unusual for neural networks? Any thoughts or experiences regarding this?







neural-network classification loss-function regularization






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 4 at 18:16









fast-reflexesfast-reflexes

1011




1011











  • $begingroup$
    How about treating it as a regression problem, if there is a clear mapping from the classes to scalar values? if your categories are like age ranges "18-24", "25-40", etc, then treat these as a scalar that's the midpoint of the range.
    $endgroup$
    – Sean Owen
    Apr 4 at 19:37










  • $begingroup$
    Makes sense but would that imply changing the architecture altogether, turning the problem into a regression problem instead of a classification problem? I think the problem might be that I have 96 classes and scaling them to be in [0, 1] would give a very dense population in that small interval... I feel like such a model wouldn't be successful in predicting the exact right value very often even though it would be successful in the way that it would often be in the vicinity of the right value... but maybe I am mistaken, I have done much more classification than regression.
    $endgroup$
    – fast-reflexes
    Apr 6 at 11:20
















  • $begingroup$
    How about treating it as a regression problem, if there is a clear mapping from the classes to scalar values? if your categories are like age ranges "18-24", "25-40", etc, then treat these as a scalar that's the midpoint of the range.
    $endgroup$
    – Sean Owen
    Apr 4 at 19:37










  • $begingroup$
    Makes sense but would that imply changing the architecture altogether, turning the problem into a regression problem instead of a classification problem? I think the problem might be that I have 96 classes and scaling them to be in [0, 1] would give a very dense population in that small interval... I feel like such a model wouldn't be successful in predicting the exact right value very often even though it would be successful in the way that it would often be in the vicinity of the right value... but maybe I am mistaken, I have done much more classification than regression.
    $endgroup$
    – fast-reflexes
    Apr 6 at 11:20















$begingroup$
How about treating it as a regression problem, if there is a clear mapping from the classes to scalar values? if your categories are like age ranges "18-24", "25-40", etc, then treat these as a scalar that's the midpoint of the range.
$endgroup$
– Sean Owen
Apr 4 at 19:37




$begingroup$
How about treating it as a regression problem, if there is a clear mapping from the classes to scalar values? if your categories are like age ranges "18-24", "25-40", etc, then treat these as a scalar that's the midpoint of the range.
$endgroup$
– Sean Owen
Apr 4 at 19:37












$begingroup$
Makes sense but would that imply changing the architecture altogether, turning the problem into a regression problem instead of a classification problem? I think the problem might be that I have 96 classes and scaling them to be in [0, 1] would give a very dense population in that small interval... I feel like such a model wouldn't be successful in predicting the exact right value very often even though it would be successful in the way that it would often be in the vicinity of the right value... but maybe I am mistaken, I have done much more classification than regression.
$endgroup$
– fast-reflexes
Apr 6 at 11:20




$begingroup$
Makes sense but would that imply changing the architecture altogether, turning the problem into a regression problem instead of a classification problem? I think the problem might be that I have 96 classes and scaling them to be in [0, 1] would give a very dense population in that small interval... I feel like such a model wouldn't be successful in predicting the exact right value very often even though it would be successful in the way that it would often be in the vicinity of the right value... but maybe I am mistaken, I have done much more classification than regression.
$endgroup$
– fast-reflexes
Apr 6 at 11:20










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48626%2fadditional-loss-regularization-term-based-on-distance-in-classification-of-ord%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Data Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48626%2fadditional-loss-regularization-term-based-on-distance-in-classification-of-ord%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?