python : AttributeError: 'str' object has no attribute 'keys'

后端 未结 1 1334
南旧
南旧 2021-01-26 03:08

I\'m trying to solve classification problem. I don\'t know why I\'m getting this error:

AttributeError: \'str\' object has no attribute \'keys\'

相关标签:
1条回答
  • 2021-01-26 03:49

    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.

    0 讨论(0)
提交回复
热议问题