Questions tagged [multiclass-classification]
776 questions
5
votes
1 answer
Does scikit-learn use One-Vs-Rest by default in multi-class classification?
I am dealing with a multi-class problem (4 classes) and I am trying to solve it with scikit-learn in Python.
I saw that I have three options:
I simply instantiate a classifier, then I fit with train and evaluate with test;
classifier =…

rusiano
- 364
- 2
- 11
5
votes
2 answers
How to set weights in multi-class classification in xgboost for imbalanced data?
I know that you can set scale_pos_weight for an imbalanced dataset. However, How to deal with the multi-classification problem in the imbalanced dataset. I have gone through…

Abhishek Niranjan
- 153
- 1
- 2
- 10
5
votes
3 answers
Which classification to choose?
I have huge amount of yelp data and I have to classify the reviews into 8 different categories.
Categories
Cleanliness
Customer Service
Parking
Billing
Food Pricing
Food Quality
Waiting time
Unspecified
Reviews contains multiple categories so I…

lucy
- 4,136
- 5
- 30
- 47
5
votes
1 answer
Keras custom loss with missing values in multi-class classification
Hello I have training data with a lot of missing values in labels, where for example a single label can have the following values:
[nan, 0, 0, nan, 1, 0]
I would like to train a classification model that ignores the nan values. Currently I have…

CCXD
- 51
- 2
4
votes
1 answer
ValueError: Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 50), found shape=(None, 1, 512)
Learning to use bert-base-cased and a classification model... the code for the model is the following:
def mao_func(input_ids, masks, labels):
return {'input_ids':input_ids, 'attention_mask':masks}, labels
dataset =…

CharlieArreola
- 51
- 1
- 3
4
votes
1 answer
Error : "Number of classes in y_true not equal to the number of columns in 'y_score'"
i have an imbalanced multiclass dataset , when i try to compute the roc_auc_score i get this error: ValueError: Number of classes in y_true not equal to the number of columns in 'y_score'.
here is the code:
model = svm.SVC(kernel='linear',…

nesrine-bn
- 41
- 1
- 3
4
votes
1 answer
Probability threshold for multi class classification
I am using Random Forest in Python to classify my data into 6 classes. My data are X,Y,Z coordinates, some geometric features and labels. I am using the geometric features and the labels to train the classifier using the training set (a random 70%…

Annie
- 41
- 1
- 2
4
votes
1 answer
Python Catboost: Multiclass F1 score custom metric
How do you find the F1-score for each class of a multiclass Catboost Classifier? I've already read through the documentation and the github repo where someone asks the same question. However, I am unable to figure out the codesmithing to achieve…

user2205916
- 3,196
- 11
- 54
- 82
4
votes
1 answer
PyTorch LSTM for multiclass classification: TypeError: '<' not supported between instances of 'Example' and 'Example'
I am trying to modify the code in this Tutorial to adapt it to a multiclass data (I have 55 distinct classes). An error is triggered and I am uncertain of the root cause. The changes I made to this tutorial have been annotated in same-line…

jbuddy_13
- 902
- 2
- 12
- 34
4
votes
1 answer
Apply a PyTorch CrossEntropy method for multiclass segmentation
I am trying to implement a simple example of how to apply cross-entropy to what is supposed to be the output of my semantic segmentation CNN.
Using the pytorch format I would have something like this:
out = np.array([[
[
[1.,1, 1],
…

lvl
- 109
- 3
- 6
4
votes
2 answers
Plotting ROC Curve with Multiple Classes
I am following the documentation for plotting ROC curves for multiple classes at this link: http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html
I am confused about this line in particular:
y_score = classifier.fit(X_train,…

bcarmel
- 91
- 1
- 1
- 7
4
votes
1 answer
Keras Multilabel Multiclass Individual Tag Accuracy
I'm trying to perform a multiclass multilabel classification with a CNN in Keras. I've attempted to create an individual label accuracy function based on this function from a similar question
The relevant code I have attempted is:
labels = ["dog",…

Matthew Ciaramitaro
- 1,184
- 1
- 13
- 27
4
votes
1 answer
ValueError: Can't handle mix of multilabel-indicator and binary
I am using Keras with the scikit-learn wrapper. In particular, I want to use GridSearchCV for hyper-parameters optimisation.
This is a multi-class problem, i.e. the target variable can have only one label chosen on a set of n classes. For instance,…

gc5
- 9,468
- 24
- 90
- 151
3
votes
1 answer
A data resampler based on support vectors
I am working to implement a data resampler to work based on support vectors. The idea is to fit an SVM classifier, get the support vector points of the classes, then balance the data by selecting only data points near the support vectors points of…

arilwan
- 3,374
- 5
- 26
- 62
3
votes
1 answer
tensorflow automatic accuracy calculation for multilabel classifier
I am fitting a multilabel classifier to (train_x, train_y) while monitoring the loss and accuracy on a validation set (val_x, val_y):
classification_model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.0002),
…

Jonas De Schouwer
- 755
- 1
- 9
- 15