4 votes
Accepted

Why do we use the softmax instead of no activation function?

Short answer: Generally, you don't need to do softmax if you don't need probabilities. And using raw logits leads to more numerically stable code. Long answer: ...
  • 1,962
4 votes

How to implement an "unknown" class in multi-class classification with neural networks?

The usual way to implement this would be to add the new class with data examples. Some things you need to address: Sourcing new data for your "other" class. Ensuring the amount and variation of ...
  • 25.4k
3 votes

How to implement an "unknown" class in multi-class classification with neural networks?

If you are using a softmax distribution for your classification, then you could determine what your baseline max probability is for correctly classified samples, and then infer if a new sample doesn't ...
3 votes
Accepted

How can I prevent the CNN from classifying a new input into one of the existing labels (it was trained with) when the input has a new different label?

You can introduce another class to your network - "not a book". After that, you will need to add new data to your dataset, random images that do not contain books to classify and train your network on ...
  • 276
2 votes
Accepted

What is the general procedure to use and train neural networks for multi-class classification?

Let's say we have $K$ classes. For $K$ classes, we will be training $K$ different neural networks. No, you still train one network. With binary classification tasks, where you have only two mutually ...
2 votes

What is the general procedure to use and train neural networks for multi-class classification?

Let us suppose that you are training a neural network for classfing images of vehicles , then the input vector , image of the "vehicle" will be a 2D array of pixels. This undergoes several ...
2 votes
Accepted

How do I calculate the probabilities of the BERT model prediction logits?

Your call to model.predict() is returning the logits for softmax. This is useful for training purposes. To get probabilties, you need to apply softmax on the logits....
  • 25.4k
2 votes
Accepted

Why would the "improvement" be the result of random initialization, and so why should we use multiple runs?

Neural networks use random number generators in multiple places. Most notably for weight initialisation, but also for features such as dropout, selecting minibatches within epochs, and train/cv split ...
  • 25.4k
1 vote

Image classification problem with multiple right classes

This is a good question. There are definitely good reasons for wanting a loss function that evaluates whether at least one of the classes was picked up by the model. To do what you are attempting, I ...
1 vote

1D Sequence Classification with self-supervised learning

In SSL (language modelling, for example), you do not have any explicit labels, just sequences of words that make sense together. SSL tries to model the language by next-word prediction, but the words ...
1 vote

Low accuracy and high loss in multi-class classification

Your model is completely underfit Reasons: You have a very small neural network that can't generalize your problem. you mentioned 17 classes but in the last layers, you are specifying 16 class ...
  • 111
1 vote

How to label unsupervised data for deep learning multi-classification

"is it okay to use another machine learning technology such as K-Means clustering to label the data?" In computer vision there's an entire branch called automatic image annotation dedicated ...
1 vote

Multi-class classification but a single feature sometimes boils it down to a binary-classification

I think a custom loss function would be an overkill in this situation. A linear pattern like this would be easily learned by any loss desinged for multi class classification. If I were you I would try ...
1 vote

When to use Multi-class CNN vs. one-class CNN

I am not really a fan of the 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 ...
  • 71
1 vote

How do I select the class weights for the loss function in the case of more than 2 classes?

Is that what you want? w_0 = (n_0+n_1+ ... +n_5) / (5.0 * n+0) If so, it can be achieved by: ...
1 vote

How to perform multi-class text classification with a dataset of 80 documents?

For pretrained models in NLP, look at BERT and RoBERTa. If you can find a language model trained on your data's superset on Huggingface, then, use that pretrained model. In order to multiclass ...
1 vote

Is Mask R-CNN suited to solve a multi-class classification problem where the classes are related?

Mask RCNN can be a very heavy function for a simple class classification. It is designed to handle multiple object in a single image. So I would suggest you could use much simpler models like VGGnet ...

Only top scored, non community-wiki answers of a minimum length are eligible