`ValueError: The Least Populated Class In Y Has Only 1 Member, Which Is Too Few` In PyCaret
I have a problem, working with PyCaret. Previously I did not have any problems.
But it started when I oversampled data and saved it, using
pandas and this question.
The file is here.
Then I read the file in a separate notebook.
import pycaret from pycaret.utils import version from pycaret.regression import * from pycaret.classification import * # Read clean data starbucks_days = pd.read_csv('days_smote.csv') # Drop a column starbucks_days = starbucks_days.drop(['Unnamed: 0'], axis = 1) starbucks_days = starbucks_days.drop(['transaction', 'offer_viewed', 'offer_received', 'offer_completed'], axis = 1) starbucks_days = starbucks_days.drop(['label'], axis = 1)
The I start to use PyCaret
# Initialize Setup starbucks_days1 = setup(starbucks_days, target = 'time_completed_viewed', session_id = 123, log_experiment = True, experiment_name = 'days1')
But get an error
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.
I check some parameters
type(starbucks_days) pandas.core.frame.DataFrame starbucks_days['time_completed_viewed'].value_counts() 6.000000 1682 12.000000 1503 18.000000 1318 24.000000 1212 174.000000 1068 ... 444.107530 1 226.213225 1 411.947513 1 236.001744 1 394.722944 1 Name: time_completed_viewed, Length: 3572, dtype: int64
Any tips what am I missing? As I said, PyCaret works just fine with simple csv files, which were not oversampled.
In your imports, you have imported
classification after importing
regression that has overwritten the module in the environment.
This seems like a regression problem (continuous value). You don't need to import
Get rid of this line from your code and it should work fine:
from pycaret.classification import *
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module