Class weights in binary classification model with Keras : <p>We know that we can pass a class weights dictionary in the fit method for imbalanced data in binary classification model. My question is that, when using only 1 node in the output layer with sigmoid activation, can we still apply the class weights during the training? </p>

<pre class="lang-py prettyprint-override"><code>model = Sequential()
model.add(Dense(64, activation='tanh',input_shape=(len(x_train[0]),)))
model.add(Dense(1, activation='sigmoid')) 

model.compile(
    optimizer=optimizer, 
    loss=loss, 
    metrics=metrics)

model.fit(
    x_train, y_train, 
    epochs=args.e, 
    batch_size=batch_size,
    class_weight={0: 1, 1: 3})
</code></pre>
