Post

KerasKeras

J
James ROBERT

Posted on 8th May 2024|133 views

0
votes

Keras Class Weight

How can we set class weights for the imbalance classes in Keras?

Answers
P
sreelu 123

Posted on 8th May 2024

We can simply set class_weight = auto to weight all the classes equally see the below example.

model.fit(X_train, Y_train, nb_epoch=5, batch_size=32, class_weight = 'auto')

If you are looking for the Keras certification course, you can check out this Keras course by Mindmajix.

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos