Answers.Body: <p>I am not really a fan of the <a href="https://developers.google.com/machine-learning/crash-course/multi-class-neural-networks/one-vs-all" rel="nofollow noreferrer">One vs All</a> approach.</p>
  <p>From my experience it is never convenient to transform a multi-class classification problem with, say, <span class="math-container">$N$</span> possible classes to a bunch of binary classification problems.</p>
  <h2>Reason #1</h2>
  <p>The number of binary classifiers you need to train scales linearly with the number of classes. Hence, you can easily find yourselves training lots of binary classifiers. What if each one of them has a huge number of neurons? As you can understand, the computational burden here is quite a problem.</p>
  <h2>Reason #2</h2>
  <p>With a small <span class="math-container">$N$</span>, the computation is less of a problem, but still.. why would you do that? By doing things like this, you can easily end up in awkward situations such as two or more of your binary classifiers give a positive outcome, or none activates. How do you handle these issues?</p>
  <hr />
  <p>However, there exists a very specific setup where you might want to use a set of binary classifiers, and this is when you're facing a <a href="https://towardsdatascience.com/continual-learning-where-are-we-d5706e78a295" rel="nofollow noreferrer">Continual Learning</a>(CL) problem. In a Continual Learning setting you don't have access to all the classes at training time, therefore, sometimes you might want to act at a architectural level to control <a href="https://arxiv.org/abs/2007.00487" rel="nofollow noreferrer">catastrophic forgetting</a>, by adding new classifiers to train. However, even in CL there exist other methods that work better.</p>
  <p>To conclude, I wouldn't recommend anyone go for this option. You can train a multi-class classifier much more easily and avoid all the aforementioned issues.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T15:23:36.063Z
Answers.Text: Hi @danin thank you for your reply. If I've understood correctly from your answer, this seems to be a bit of an engineering and computational complexity issue? Not really about the theoretical perfomance?
Answers.UserDisplayName: jjepsuomi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T15:32:47.873Z
Answers.Text: We would be interested in selecting the approach which has the best performance. I would suspect, a general multi-class classifier cannot reach the same performance as a specialized one-class model, even though computationally more easier approach, unless we have a huge amount of data. Still, I would suspect case specific models should, in theory always beat the general purpose models. Or am I mistaken? Anyway, I'm in no big favor of either approaches, it depends on the problem we are solving.
Answers.UserDisplayName: jjepsuomi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T19:13:37.447Z
Answers.Text: It is always difficult to speak about theoretical performance for machine learning models. The reason is that there's no well established theory on the choice of the model architecture. Thus, we can't really know whether one model would perform better than the other. Still, I would expect multi-class models to generalise better to unknown samples. From my experience with one-class models (not very experienced to be honest), I've always seen that they tend to overfit more than general-purpose models. I'd recommend you try training both models and see which one gives the best test result :-)
Answers.UserDisplayName: danin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T19:57:34.780Z
Answers.Text: Okay, thank you for your comment! :) Good point, yeah it's not that trivial always. Have to give this some more thought.
Answers.UserDisplayName: jjepsuomi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T15:15:32.640Z
Answers.LastActivityDate: 2021-09-30T15:15:32.640Z
Answers.UserDisplayName: danin
Body: <p>I'm building an object detection model with convolutional neural networks (CNN) and I started to wonder when should one use either multi-class CNN or a single-class CNN. That is, if I'm making e.g. a human detector from image data and a cat detector also from image data, then when should I have a specific model for each task, and when should I just combine all the data into one and use just one general multi-class CNN?</p>
  <p>I've understood from the <a href="https://en.wikipedia.org/wiki/No_free_lunch_theorem" rel="nofollow noreferrer">No-Free-Lunch-Theorem</a> and generally from <a href="https://link.springer.com/book/10.1007/b98854" rel="nofollow noreferrer">estimation theory</a>, that there there does not, in theory, exist a model which is simultaneously optimal for every problem. In other words, case specific models should, in general, beat the &quot;all-purpose&quot;-models in the same task.</p>
  <p>I have a difference in opinion with a colleague of mine whether to use one-class of a multi-class CNN and I would like to hear the communities opinion on this.</p>
  
Tags: <convolutional-neural-networks><multiclass-classification>
Title: When to use Multi-class CNN vs. one-class CNN
UserDisplayName: jjepsuomi
ThreadText: # When to use Multi-class CNN vs. one-class CNN
  
  (Asked by: username_0 on 2021-09-30)
  
  I'm building an object detection model with convolutional neural networks (CNN) and I started to wonder when should one use either multi-class CNN or a single-class CNN. That is, if I'm making e.g. a human detector from image data and a cat detector also from image data, then when should I have a specific model for each task, and when should I just combine all the data into one and use just one general multi-class CNN?
  
  I've understood from the [No-Free-Lunch-Theorem](https://en.wikipedia.org/wiki/No_free_lunch_theorem) and generally from [estimation theory](https://link.springer.com/book/10.1007/b98854), that there there does not, in theory, exist a model which is simultaneously optimal for every problem. In other words, case specific models should, in general, beat the "all-purpose"-models in the same task.
  
  I have a difference in opinion with a colleague of mine whether to use one-class of a multi-class CNN and I would like to hear the communities opinion on this.
  
  **Tags:** convolutional-neural-networks, multiclass-classification
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-30. Score: 1
  
  I am not really a fan of the [One vs All](https://developers.google.com/machine-learning/crash-course/multi-class-neural-networks/one-vs-all) approach.
  
  From my experience it is never convenient to transform a multi-class classification problem with, say, $N$ possible classes to a bunch of binary classification problems.
  
  ## Reason #1
  
  The number of binary classifiers you need to train scales linearly with the number of classes. Hence, you can easily find yourselves training lots of binary classifiers. What if each one of them has a huge number of neurons? As you can understand, the computational burden here is quite a problem.
  
  ## Reason #2
  
  With a small $N$, the computation is less of a problem, but still.. why would you do that? By doing things like this, you can easily end up in awkward situations such as two or more of your binary classifiers give a positive outcome, or none activates. How do you handle these issues?
  
  ---
  
  However, there exists a very specific setup where you might want to use a set of binary classifiers, and this is when you're facing a [Continual Learning](https://towardsdatascience.com/continual-learning-where-are-we-d5706e78a295)(CL) problem. In a Continual Learning setting you don't have access to all the classes at training time, therefore, sometimes you might want to act at a architectural level to control [catastrophic forgetting](https://arxiv.org/abs/2007.00487), by adding new classifiers to train. However, even in CL there exist other methods that work better.
  
  To conclude, I wouldn't recommend anyone go for this option. You can train a multi-class classifier much more easily and avoid all the aforementioned issues.
  
  > **Comments:**
  > **username_0**: Hi @username_1 thank you for your reply. If I've understood correctly from your answer, this seems to be a bit of an engineering and computational complexity issue? Not really about the theoretical perfomance?  
  > **username_0**: We would be interested in selecting the approach which has the best performance. I would suspect, a general multi-class classifier cannot reach the same performance as a specialized one-class model, even though computationally more easier approach, unless we have a huge amount of data. Still, I would suspect case specific models should, in theory always beat the general purpose models. Or am I mistaken? Anyway, I'm in no big favor of either approaches, it depends on the problem we are solving.  
  > **username_1**: It is always difficult to speak about theoretical performance for machine learning models. The reason is that there's no well established theory on the choice of the model architecture. Thus, we can't really know whether one model would perform better than the other. Still, I would expect multi-class models to generalise better to unknown samples. From my experience with one-class models (not very experienced to be honest), I've always seen that they tend to overfit more than general-purpose models. I'd recommend you try training both models and see which one gives the best test result :-)  
  > **username_0**: Okay, thank you for your comment! :) Good point, yeah it's not that trivial always. Have to give this some more thought.  
  
  ---
  
  