📜  使用样本权重拟合模型多类 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:24.079000             🧑  作者: Mango

代码示例1
from sklearn.utils import class_weight


class_weights = class_weight.compute_class_weight('balanced',
                                                 np.unique(y_train),
                                                 y_train)


model.fit(X_train, y_train, class_weight=class_weights)