How would I go about doing [multiclass] cost-sensitive classification (meaning each example has its own misclassification cost) in Keras?
You may use the sample_weight parameter http://keras.io/models/sequential/#fit
sample_weight: Numpy array of weights for the training samples, used for scaling the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile().
Thank you
Hi,
May I know how this is done in the case of FCN which outputs an image? I have an image which has foreground and back ground (Binary class problem). Back ground pixels covers 90% of the image approximately. I want to penalize foreground pixel if it is classified as background pixel.
Thank you for any help
Most helpful comment
You may use the sample_weight parameter http://keras.io/models/sequential/#fit