Answers.Body: <p>From your case, it seems like you want your algorithm to classify both 1s and 0s with high accuracy. To increase the number of 1s and get it to a comparable level as 0s, you could generate new examples of 0s by tweaking some features or adding random noise.</p>
  <p>If you don't care about classifying 0s and only care about classifying 1s (which doesn't seem like what you want to do but putting this out there), you can create a surrogate loss function which assigns more loss weight to 1s than 0s (eg - 1000 weight for 1s and 1 weight for 0s.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-16T03:46:11.640Z
Answers.LastActivityDate: 2023-07-16T03:46:11.640Z
Answers.UserDisplayName: AdiCoder
Answers.Body: <p>As described in <a href="https://www.pisciottablog.com/2020/10/24/unbalanced-datasets-in-machine-learning/" rel="nofollow noreferrer">this post</a>, this problem is known as &quot;unbalanced dataset&quot; problem, which can have different solution approaches. If you use supervised learning, augmentation approaches
  could  help. Otherwise, unsupervised approaches need some proper distance measure for outliers detection.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-27T14:15:35.747Z
Answers.LastActivityDate: 2020-10-27T14:15:35.747Z
Answers.UserDisplayName: Marvin
Body: <p>Assuming we have big <span class="math-container">$m \times n$</span> input dataset, with <span class="math-container">$m \times 1$</span> output vector. It's a <strong>classification</strong> problem with only two possible values: either <span class="math-container">$1$</span> or <span class="math-container">$0$</span>.</p>
  <p>Now, the problem is that almost all elements of the output vector are <span class="math-container">$0$</span>s with a very few <span class="math-container">$1$</span>s (i.e. it's a sparse vector), such that if the neural network would &quot;learn&quot; to give <strong>always</strong> 0 as output, this would produce high accuracy, while I'm also interested in learning when the 1s occurs.</p>
  <p>I thought one possible approach could be to write a custom loss function giving more weight to the 1s, but I'm not completely sure if this would be a good solution.</p>
  <p>What kind of strategy can be applied to detect such outliers?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-28T17:08:27.917Z
Comments.Text: I like this discussion about accuracy as a scoring rule: https://stats.stackexchange.com/q/312780/247274.
Comments.UserDisplayName: Dave
Tags: <machine-learning><datasets><objective-functions><binary-classification><imbalanced-datasets>
Title: How to perform binary classification when one class is more predominant than the other?
UserDisplayName: Marvin
ThreadText: # How to perform binary classification when one class is more predominant than the other?
  
  (Asked by: username_0 on 2019-12-23)
  
  Assuming we have big $m \times n$ input dataset, with $m \times 1$ output vector. It's a **classification** problem with only two possible values: either $1$ or $0$.
  
  Now, the problem is that almost all elements of the output vector are $0$s with a very few $1$s (i.e. it's a sparse vector), such that if the neural network would "learn" to give **always** 0 as output, this would produce high accuracy, while I'm also interested in learning when the 1s occurs.
  
  I thought one possible approach could be to write a custom loss function giving more weight to the 1s, but I'm not completely sure if this would be a good solution.
  
  What kind of strategy can be applied to detect such outliers?
  
  **Tags:** machine-learning, datasets, objective-functions, binary-classification, imbalanced-datasets
  > **Comments:**
  > **username_1**: I like this discussion about accuracy as a scoring rule: https://stats.stackexchange.com/q/312780/247274.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2023-07-16. Score: 1
  
  From your case, it seems like you want your algorithm to classify both 1s and 0s with high accuracy. To increase the number of 1s and get it to a comparable level as 0s, you could generate new examples of 0s by tweaking some features or adding random noise.
  
  If you don't care about classifying 0s and only care about classifying 1s (which doesn't seem like what you want to do but putting this out there), you can create a surrogate loss function which assigns more loss weight to 1s than 0s (eg - 1000 weight for 1s and 1 weight for 0s.)
  
  
  ---
  
  ### Answer by username_0 on 2020-10-27. Score: 0
  
  As described in [this post](https://www.pisciottablog.com/2020/10/24/unbalanced-datasets-in-machine-learning/), this problem is known as "unbalanced dataset" problem, which can have different solution approaches. If you use supervised learning, augmentation approaches
  could help. Otherwise, unsupervised approaches need some proper distance measure for outliers detection.
  
  
  ---
  
  