All Questions
Tagged with class-imbalance python
72 questions
11
votes
1
answer
4k
views
Why you shouldn't upsample before cross validation
I have an imbalanced dataset and I am trying different methods to address the data imbalance. I found this article that explains the correct way to cross-validate when oversampling data using SMOTE ...
11
votes
1
answer
13k
views
Imbalanced dataset in MLP classifier in python
I am dealing with imbalanced dataset and I try to make a predictive model using MLP classifier. Unfortunately the algorithm classifies all the observations from test set to class "1" and hence the f1 ...
10
votes
1
answer
47k
views
How does class_weights work in RandomForestClassifier
I'm facing a problem with unbalanced classes, and have tried out a couple of methods like over and under sampling. However, my cross validation mean comes out to be only 0.4 and my confusion matrix ...
9
votes
3
answers
5k
views
Is There a Way to Re-Calibrate Predicted Probabilities After Using Class Weights?
I have classification data with far more negative instances than positive instances. I have used class weights in my models and have achieved the discrimination I want but the predicted probabilities ...
7
votes
1
answer
2k
views
What is the best performance metric used in balancing dataset using SMOTE technique
I used smote technique to oversample my dataset and now I have a balanced dataset. The problem I faced is that the performance metrics; precision, recall, f1 measure, accuracy in the imbalanced ...
7
votes
1
answer
6k
views
Overfitting for minority class after SMOTE w/ random forests
I used SMOTE to make a predictive model, with class 1 having 1800 samples and 35000+ of class 0 samples. Hence, as per SMOTE, synthetic samples were created and the random forest was trained.
However,...
6
votes
2
answers
658
views
Can we specify the number of data generated(minority class) using SMOTE?
I am trying to improve classification of imbalanced dataset creditcard fraud using SMOTE imbalanced_learn. But, in this it generates the data to 50%, can we give a specific number for the data to be ...
6
votes
1
answer
2k
views
How to avoid resampling part of pipeline on test data (imblearn package, SMOTE)
I am using the imblearn package to resample some data before applying other transformation/prediction techniques. Specfically, I am using SMOTE in a slightly unconventional way, as a data ...
6
votes
4
answers
35k
views
SMOTE and multi class oversampling
I have read that the SMOTE package is implemented for binary classification. In the case of n classes, it creates additional examples for the smallest class. Can I balance all the classes by running ...
4
votes
2
answers
7k
views
Imbalanced Dataset: Train/test split before and after SMOTE
This question is similar but different from my previous one. I have a binary classification task related to customer churn for a bank. The dataset contains 10,000 instances and 11 features. The target ...
4
votes
2
answers
2k
views
Flipping the labels in a binary classification gives different model and results
I have an imbalanced dataset and I want to train a binary classifier to model the dataset.
Here was my approach which resulted into (relatively) acceptable performance:
1- I made a random split to get ...
4
votes
3
answers
8k
views
How to Split And Resample Imbalanced Dataset Into Train, Validation and Test
I want to understand how to split the imbalanced data set with a binary target variable where 87% of the samples are negative and 13% of the samples are positive. Now, I know that you should always ...
4
votes
1
answer
587
views
Why removing rows with NA values from the majority class improves model performance
I have an imbalanced dataset like so:
df['y'].value_counts(normalize=True) * 100
...
4
votes
0
answers
527
views
How to apply oversampling when doing Leave-One-Group-Out cross validation?
I am working on an imbalanced data for classification and I tried to use SMOTE previously to oversampling the training data. However, this time I think I need to use a leave-on group out (LOGO) cross-...
3
votes
2
answers
3k
views
Outlier detection for unbalanced classes
I have to make a predictive model for predicting a boolean Won/Lost variable based on some other numeric data; and further find out the features of observations that have 'Won'.
However, the number ...
3
votes
1
answer
297
views
Features selection in imbalanced dataset
I have some doubts regarding an analysis. I have a dataset with class imbalance. I am trying to investigate some information from that data, e.g., how many urls contain http or https protocols.
My ...
3
votes
1
answer
103
views
Machine Learning: Balanced training set but highly unbalanced prediction set? How to adjust?
I am trying to train a model to detect gender in a dataset of CEO speeches. Here are the datasets that I have:
Final Dataset: 20K CEO voices analyzed (around 95% male)
Testing dataset (?): 1K CEO ...
3
votes
2
answers
4k
views
How to compute G-mean score?
I would greatly appreciate if you could let me know how to fix the following issue:
I used sklearn.metrics.fowlkes_mallows_score to compute G-mean score for my binary classification problem, but it ...
3
votes
1
answer
810
views
What does IBA mean in imblearn classification report?
imblearn is a python library for handling imbalanced data. A code for generating classification report is given below.
...
3
votes
0
answers
824
views
Balancing the dataset using imblearn undersampling, oversampling and combine?
I have the imbalanced dataset:
data['Class'].value_counts()
Out[22]:
0 137757
1 4905
Name: Class, dtype: int64
...
3
votes
0
answers
436
views
Adjust class weights due to class imbalance and class importance Multi class classification XGBoost
With respect to this question and the answer given by @Esmailian, Would anyone be able to let me know if Class B has a higher importance or the positive class ( i.e. it needs to have a higher ...
3
votes
3
answers
3k
views
imbalanced dataset in text classififaction
I have a data set collected from Facebook consists of 10 class, each class have 2500 posts, but when count number of unique words in each class, they has different count as shown in the figure
Is ...
2
votes
2
answers
317
views
Influence of imbalanced feature on prediction
I want to use XGB regression. the dataframe is coneptually similar to this table:
...
2
votes
3
answers
4k
views
Handling large imbalanced data set
I have an imbalanced data set consisting of some 10's of millions text strings, each with thousands of features created by uni- and bigrams, and additionally I have also the string length and entropy ...
2
votes
2
answers
5k
views
How correctly assign weights to minority class or samples in ANN?
Having an imbalanced dataset. Abnormal class rate is %5. To handle with the problem I have gave extra weight to the abnormal class. However, It did not change anything. Here is my code:
...
2
votes
2
answers
5k
views
Random Forest Classifier Probabilities
My dataset has 140k rows with 5 attributes and 1 Attrition as target variable (value can either be 0 (Customer churn) or 1 (Customer Does not churn)). I divided my dataset in 80% training and 20% ...
2
votes
4
answers
1k
views
Best methods to solve class imbalance problem and why?
I have a data set where I need to detect fraud. 99% are not fraud and 1% are.
What methods can be used to solve problems where classes are imbalanced?
2
votes
1
answer
2k
views
EasyEnsemble explaination
Could someone please explain how the EasyEnsemble algorithm works? Im using it for a prediction model for imbalanced minority class.
Please don't refer me to this paper, as it makes no sense to me.
...
2
votes
1
answer
1k
views
Adjusting imbalance in classification problem reduce precision, accuracy but increase recall
I've learned that adjusting imbalanced data when training a CNN affects model performance which got me thinking "what about in ML?" so I've done some testing on my own, you can check it out ...
2
votes
1
answer
3k
views
Multi class Imbalanced datasets under-sampling imblearn
I have an imbalanced dataset. I am looking to under-sample. Even though, the oversampling process takes less time, the model training takes a lot of time. I have taken a look at imbalanced-learn ...
2
votes
2
answers
1k
views
Plotting a no-skill model in a precision-recall curve
I am following this tutorial to apply threshold tuning using precision-recall curve for an imbalanced dataset
Within the tutorial, a no-skill model is defined as:
A no-skill model is represented by a ...
2
votes
1
answer
215
views
Oversampling possible improvement
I am currently solving a classification problem for an imbalanced data set (approximately 17% of the minority class). I split the data using a stratified k-fold split from sklearn (Stratified shuffle ...
2
votes
1
answer
368
views
How to evaluate model with imbalanced data binary classification?
I have a binary classification problem. I am using Area under precision recall curve as the evaluation metric. The dimensions of my data are (211, 1361). The data is imbalanced so I have used various ...
2
votes
1
answer
145
views
Unbalanced multi-class : distribution might change as more data come in
I am currently working on a problem of multi-class classification on testing logs data.
Basically, I have the context data from tests' execution saved, and want to automate the analysis of the ...
2
votes
2
answers
6k
views
Creating Balanced Dataset Using Scikits
I have a classic User-Item dataset where each row (i.e., (user, item)) indicates the action of a user clicking/selecting an item....
2
votes
1
answer
45
views
Techniques for solving the problem with an unbalanced data set
I am trying to solve a problem with an unbalanced data set. I have two classes, one is for patients with risk (1), the other for patients without risk (0). I have a larger number of patients without ...
2
votes
0
answers
542
views
How can I use the Brier Skill Score in cross-validation for imbalanced data?
I wish to use search for model hyper-parameters (by a grid search) using the Brier score as the scoring method (see code below):
...
2
votes
0
answers
682
views
Imblanced-data: Need assistance with SMOTE technique for a CNN input
I am trying to apply the SMOTE sampling technique to over-sample the minority class of a multiclass (5-class) problem using the convolutional neural network. As far CNN requirement, the input shape ...
1
vote
3
answers
23k
views
imblearn error installing smote
I wanna install smote from imblearn package and I got the Following error:
...
1
vote
3
answers
4k
views
Downsampling and class ratios
My target variable is whether an application is accepted or not. It is a highly imbalanced target with 98.5% of applications accepted. I am unclear about the concept of downsampling. If I were to ...
1
vote
2
answers
759
views
location of the resampled data from SMOTE
I am using SMOTE in Python to perform oversampling of the minor class in an unbalanced dataset. I would like to know the way SMOTE formats its output, that is, whether SMOTE concatenates the newly ...
1
vote
1
answer
244
views
Imbalanced classification task – Discrepancy between learning curves and test set evaluation
I have a binary classification task related to customer churn for a bank. The dataset contains 10,000 instances and 11 features. The target variable is imbalanced (80% remained as customers (0), 20% ...
1
vote
1
answer
71
views
How to handle such a large class imbalance in text data?
I am working on a multi class text classifier. The total number of class that are there is 265 and total number of rows is 20,000. The class with largest number of occurrences has 6000 samples and ...
1
vote
2
answers
625
views
Weights for unbalanced classification
I'm working with an unbalanced classification problem, in which the target variable contains:
np.bincount(y_train)
array([151953, 13273])
i.e. ...
1
vote
1
answer
2k
views
SMOTE and standardisation
I have an unbalanced dataset X.
I split it between data and labels, then I standardize the data.
Then I use train_test_split to split between train and test data and I output the result.
Now I want ...
1
vote
2
answers
220
views
Different performance for splitting into test/train data vs. using cross-validation
I am training a linear model using the following scikit-learn setup:
...
1
vote
1
answer
340
views
suggestion to implement undersample and oversample
My dataset has the following class distribution
...
1
vote
0
answers
24
views
Handling imbalanced Feature (X) not lavbel (Y) in machine learning
I am very new to this field and have done a decent amount of research on this, but every time, I stumble upon handling the imbalanced label by using f1 score, recall, precision as metrics, and using ...
1
vote
0
answers
201
views
Should I use Pad Sequence when using Word Vectors?
I have an unbalanced text data set. I want to use word vectors to embed words. When I use pad sequence? Before or after the word vector? I tried it, after the word vector I used pad sequence but my ...