Answers.Body: <p>I think your approach to tackle this as an imbalanced problem is correct. The easiest thing you could do is to add weights to the samples, during training, so that the model "pays more attention" to the under-represented class. </p>
  
  <p>There are also a couple of other ways for this to be done: oversampling and undersampling, but initially, I'd focus on adding weights, since its easier to implement.  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-18T15:53:28.650Z
Answers.Text: Thanks! I am pretty new to this and I am reading about it now. I stumbled upon the technique of importance sampling/weighting. Would you use this to add weights to the samples? If not, how would you do this? And will each sample weight be added to the loss function in this case? Maybe I haven't explained this in a clear way, sorry! But my challenge is that I don't want to focus on imbalanced gender in the entire dataset but per product category (which is another input feature in my model). Thanks for your help again!
Answers.UserDisplayName: nvrs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-18T23:22:09.540Z
Answers.Text: If you add weights to each sample, you have the degree of freedom to weigh them as you like. A sample from a male that belongs to a female-dominated category could get a high weight, while a female item from the same category could get a lower one. What I'm trying to say is that you can weigh your samples per gender and category if you want to. The *importance sampling* technique I'm aware of is unrelated, but it's plausible that the same name is used for different techniques.
Answers.UserDisplayName: Djib2011
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-16T23:10:49.623Z
Answers.LastActivityDate: 2020-04-16T23:10:49.623Z
Answers.UserDisplayName: Djib2011
Body: <p>I am trying to create a multiclass product-rating network based on product reviews and other input features. Two of the other input features are "product category" and "gender". However, I want to avoid unfair bias in the classification task between male/female. Since some product categories are more likely to be reviewed by males or females (hence, not balanced), I am seeking for an approach to solve this "imbalance"-like issue.</p>
  
  <p>The options and things that I consider at the moment are:</p>
  
  <ol>
  <li>Downsample the training examples in each product category to balance for gender</li>
  <li>Add weights to the training examples for gender, or</li>
  <li>Add weights to the loss function (either log-likelihood or cross-entropy)</li>
  </ol>
  
  <p>Even though downsampling might be the easiest option, I would like to explore the options of adding weights in the network in some way. However, most literature are only discussing adding weights to the loss function in order to solve for imbalanced data related to the target value (which is not the issue that I am addressing).</p>
  
  <p>Can someone help me or point me in the right direction to solve this challenge?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-14T22:18:01.820Z
Comments.Text: Welcome to SE:AI!
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-15T04:58:18.860Z
Comments.Text: Thank you @DukeZhou! Do you have any idea how I can solve my question?
Comments.UserDisplayName: nvrs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-15T23:08:12.473Z
Comments.Text: unfortunately, I'm not the right guy to ask.  (I'm sort of the itinerant philosopher on SE:AI)
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-16T07:43:38.357Z
Comments.Text: No worries! ;-) Anyone else that could help me?
Comments.UserDisplayName: nvrs
Tags: <machine-learning><deep-learning><objective-functions><ethics><algorithmic-bias>
Title: How to add weights to one specific input feature to ensure fair training in the network?
UserDisplayName: nvrs
ThreadText: # How to add weights to one specific input feature to ensure fair training in the network?
  
  (Asked by: username_0 on 2020-04-14)
  
  I am trying to create a multiclass product-rating network based on product reviews and other input features. Two of the other input features are "product category" and "gender". However, I want to avoid unfair bias in the classification task between male/female. Since some product categories are more likely to be reviewed by males or females (hence, not balanced), I am seeking for an approach to solve this "imbalance"-like issue.
  
  The options and things that I consider at the moment are:
  
  1. Downsample the training examples in each product category to balance for gender
  2. Add weights to the training examples for gender, or
  3. Add weights to the loss function (either log-likelihood or cross-entropy)
  
  Even though downsampling might be the easiest option, I would like to explore the options of adding weights in the network in some way. However, most literature are only discussing adding weights to the loss function in order to solve for imbalanced data related to the target value (which is not the issue that I am addressing).
  
  Can someone help me or point me in the right direction to solve this challenge?
  
  **Tags:** machine-learning, deep-learning, objective-functions, ethics, algorithmic-bias
  
  > **Comments:**
  > **username_1**: Welcome to SE:AI!  
  > **username_0**: Thank you @username_1! Do you have any idea how I can solve my question?  
  > **username_1**: unfortunately, I'm not the right guy to ask.  (I'm sort of the itinerant philosopher on SE:AI)  
  > **username_0**: No worries! ;-) Anyone else that could help me?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-16. Score: 1 | Accepted answer
  
  I think your approach to tackle this as an imbalanced problem is correct. The easiest thing you could do is to add weights to the samples, during training, so that the model "pays more attention" to the under-represented class.
  
  There are also a couple of other ways for this to be done: oversampling and undersampling, but initially, I'd focus on adding weights, since its easier to implement.
  
  > **Comments:**
  > **username_0**: Thanks! I am pretty new to this and I am reading about it now. I stumbled upon the technique of importance sampling/weighting. Would you use this to add weights to the samples? If not, how would you do this? And will each sample weight be added to the loss function in this case? Maybe I haven't explained this in a clear way, sorry! But my challenge is that I don't want to focus on imbalanced gender in the entire dataset but per product category (which is another input feature in my model). Thanks for your help again!  
  > **username_2**: If you add weights to each sample, you have the degree of freedom to weigh them as you like. A sample from a male that belongs to a female-dominated category could get a high weight, while a female item from the same category could get a lower one. What I'm trying to say is that you can weigh your samples per gender and category if you want to. The *importance sampling* technique I'm aware of is unrelated, but it's plausible that the same name is used for different techniques.  
  
  ---
  
  