Open sumanttyagi opened 3 years ago
Hey @sumanttyagi
You can try the following
classweights = class_weight.compute_class_weight('balanced', classes = np.unique(y), y= y_reshaped)
class_weights = {}
for i in range(n_classes):
class_weights[i] = classweights[i]
print(class_weights)
please help : when using below history = model.fit(train_x, train_y, batch_size = 16, verbose=1, epochs=10, validation_data=(test_x,test_y), class_weight=class_weights, shuffle= True)
-> 1185 if class_weight: 1186 dataset = dataset.map(_make_class_weight_map_fn(class_weight)) 1187 self._inferred_steps = self._infer_steps(steps_per_epoch, dataset)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()