text labels 0 What outdoor activity can I engage in that pro... Maintenance 1 I enjoy…
- User
text labels 0 What outdoor activity can I engage in that pro... Maintenance 1 I enjoy using my imagination to develop unique... Creative 2 What artistic pursuit can I explore to express... Artistic 3 How can I immerse myself in nature while embar... Adventure This is head of my train.csv file, I want to split the data into test train and val
- Assistant
To split your dataset into training, validation, and test sets, you can use the
train_test_splitfunction from thesklearn.model_selectionmodule. Here’s how to do it step by step:-
Read the CSV file into a DataFrame: Make sure you have the
pandaslibrary installed.
-
- User
ValueError Traceback (most recent call last) Cell In[11], line 7 5 print(df.head(4)) 6 # Step 2: Split the data into training and temporary sets (80% train, 20% temp) ----> 7 train_data, temp_data = train_test_split(df, test_size=0.2, random_state=42, stratify=df['labels']) 9 # Step 3: Split the temporary set into validation and test sets (50% val, 50% test of the temp data) 10 val_data, test_data = train_test_split(temp_data, test_size=0.5, random_state=42, stratify=temp_data['labels'])
File c:\Users\Marcin\anaconda3\Lib\site-packages\sklearn\utils_param_validation.py:213, in validate_params..decorator..wrapper(*args, **kwargs) 207 try: 208 with config_context( 209 skip_parameter_validation=( 210 prefer_skip_nested_validation or global_skip_validation 211 ) 212 ): --> 213 return func(*args, **kwargs) 214 except InvalidParameterError as e: 215 # When the function is just a wrapper around an estimator, we allow 216 # the function to delegate validation to the estimator, but we replace 217 # the name of the estimator by the name of the function in the error 218 # message to avoid confusion. 219 msg = re.sub( 220 r"parameter of \w+ must be", 221 f"parameter of {func.} must be", ... 2159 "The train_size = %d should be greater or " 2160 "equal to the number of classes = %d" % (n_train, n_classes) 2161 )
- Assistant
- User
text labels 0 What outdoor activity can I engage in that pro... Maintenance 1 I enjoy using my imagination to develop unique... Creative 2 What artistic pursuit can I explore to express... Artistic 3 How can I immerse myself in nature while embar... Adventure labels Mindfulness 16 Teamwork 16 Digital 15 Survival 15 Fitness 15 .. Communication 3 Challenge 3 Technology 3 Science 3 Intellectual 3 Name: count, Length: 74, dtype: int64
- Assistant
- User
I have in every class atleast 3, why the code isnt owkring
- Assistant