Comments (9)
Try using x_train, x_test, y_train, y_test = train_test_split(data_x,data_y,test_size=0.33, random_state=42)
. It should work
from text-classification.
This because of the nature of stratification. The stratify
parameter set it to split data in a way to allocate test_size
amount of data to each class. In this case, you don't have sufficient class labels of one of your classes to keep the data splitting ratio equal to test_size
.
from text-classification.
This because of the nature of stratification. The
stratify
parameter set it to split data in a way to allocatetest_size
amount of data to each class. In this case, you don't have sufficient class labels of one of your classes to keep the data splitting ratio equal totest_size
.
I confirm the above explanation. I have encountered this situation when dealing with a class that has a very low count . You can either take a random sample (not stratified) or try different test_size values, to be able to have an adequate size that could hold all your various labels.
from text-classification.
It might be because you have a multi-label dataset. Which in this case you can use this tutorial from sklearn.
from text-classification.
at has a very low count . You can either take a random sample (not stratified) or try different test_size values, to be able to have an adequate size that could hold all your various labels.
I think sklearn should handle such situations somehow automatically. It's frustrating and not clear immediately that it can be solved by slight fine-tuning of test_size.
from text-classification.
I am having the same problem as @vikramkone can any suggest how i can solve it?
from text-classification.
I too faced the same issue. I was trying to solve the spam text classification problem wherein mostly we have less number of spam messages. But on seeing the count of spam and ham messages, I found out that they were both equal in numbers, and without looking into the count I applied stratify = data['label']
, I removed the stratify part and I issue was solved.
from text-classification.
How can we fix this? I think random_state would be any integer because it only take permutation seeds from it.
from text-classification.
It might be because you have a multi-label dataset. Which in this case you can use this tutorial from sklearn.
Nope, my fake labels are 1,114 while real data labels are 475, now i i know this is the reason for ValueError: The least populated class in y has only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2. @WajdiBenSaad is 101% correct. i am doing a binary classification problem
from text-classification.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from text-classification.