Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: class_weight not supported for 3+ dimensional targets. with class_weight #43

Open
s1guma opened this issue Jan 12, 2023 · 0 comments

Comments

@s1guma
Copy link

s1guma commented Jan 12, 2023

Hi,

I got an error ValueError: "class_weight" not supported for 3+ dimensional targets. with class_weight, when I run a baseline.py (with only text in emotion classification)with class_weight as below that is provided in README.
I didn't make any changes to bc-LSTM model, but should I make a new loss function considering class_weight or something?
Could you give me advice to be able to use class_weight without any problems?
Thank you in advance.

using command:
python baseline.py -classify emotion -modality text -train

fit parameter:

history = model.fit(self.train_x, self.train_y,
                            epochs=self.epochs,
                            batch_size=self.batch_size,
                            sample_weight=self.train_mask,
                            shuffle=True,
                            callbacks=[early_stopping, checkpoint],
                            validation_data=(
                                self.val_x, self.val_y, self.val_mask),
                            class_weight={0: 4.0, 1: 15.0, 2: 15.0,
                                          3: 3.0, 4: 1.0, 5: 6.0, 6: 3.0}
                            )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant