Python : Attributeerror: 'str' Object Has No Attribute 'keys'
I'm trying to solve classification problem. I don't know why I'm getting this error: AttributeError: 'str' object has no attribute 'keys' This is the main code: def generate_arrays
Solution 1:
your issue is caused by class_weight="balanced"
parameter that you pass to model.fit()
according to the model.fit() reference, this parameter should be a dict: Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
try class_weight=None
for testing, it should get rid of the original error. Later provide proper dict as class_weight
to address imbalanced dataset issue.
Post a Comment for "Python : Attributeerror: 'str' Object Has No Attribute 'keys'"