4

I am training a Sequential model for regression. I noticed there is a "class_weights" parameter in the fitting function.

As I understand one can give a different importance to a class during training. But as the name states "class" I am not sure if this will only work with classification approach.

Is something like this possible with the regression approach?

Benoid
  • 209
  • 1
  • 4
  • 11
  • you can use also sample_weight: https://stackoverflow.com/questions/48315094/using-sample-weight-in-keras-for-sequence-labelling – Marco Cerliani May 31 '20 at 18:27
  • @MarcoCerliani sample_weight weighs the samples, but im talking about one singe label inside a sample. When a sample consists of X and Y, then I mean a part of the Y. Like Y=[100,200,150,100] Which is 4 labels. how can I weigh the 3rd label more than the other three in the example? Does that work with class_weighs – Benoid May 31 '20 at 21:58
  • you can also build your custom loss. ps: class_weights works like sample_weight weighting the sample – Marco Cerliani May 31 '20 at 22:04

0 Answers0