且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Scikit-学习带权重的分类和回归

更新时间:2022-06-25 20:39:24

要称量单个样品,请喂 sample_weight 数组到估算器的 fit 方法。这应该是长度为 n_samples 的一维数组(即在大多数任务中与 y 相同的维度):

To weigh individual samples, feed a sample_weight array to the estimator's fit method. This should be a 1-d array of length n_samples (i.e. the same dimension as y in most tasks):

estimator.fit(X, y, sample_weight=some_array)

并非所有型号都支持此功能,请查看文档。

Not all models support this, check the documentation.