Python skgarden.quantile.RandomForestQuantilerRegressor.fit()中未识别样本重量

Python skgarden.quantile.RandomForestQuantilerRegressor.fit()中未识别样本重量,python,scikit-learn,Python,Scikit Learn,该文档将sample_weight作为RandomForestQuantilerRegressor.fit(X,y)的一个可用参数:但是在尝试这样做时,它会抛出一个错误。它适用于DecisionTreeQuantialRegressor,但不适用于RandomForestQuantialRegressor。这是有意的吗 例如: import numpy as np import skgarden # we create 20 points np.random.seed(0) X = np.r

该文档将sample_weight作为RandomForestQuantilerRegressor.fit(X,y)的一个可用参数:但是在尝试这样做时,它会抛出一个错误。它适用于DecisionTreeQuantialRegressor,但不适用于RandomForestQuantialRegressor。这是有意的吗

例如:

import numpy as np
import skgarden 

# we create 20 points
np.random.seed(0)
X = np.r_[np.random.randn(10, 2) + [1, 1], np.random.randn(10, 2)]
y = [1] * 10 + [-1] * 10
sample_weight_last_ten = abs(np.random.randn(len(X)))
sample_weight_constant = np.ones(len(X))
# and bigger weights to some outliers
sample_weight_last_ten[15:] *= 5
sample_weight_last_ten[9] *= 15

# fit the model WITH WEIGHTS
clf_weights = skgarden.DecisionTreeQuantileRegressor(random_state=0)
clf_weights.fit(X, y, sample_weight=sample_weight_last_ten)
正确训练,但尝试此操作时:

import numpy as np
import skgarden 

# we create 20 points
np.random.seed(0)
X = np.r_[np.random.randn(10, 2) + [1, 1], np.random.randn(10, 2)]
y = [1] * 10 + [-1] * 10
sample_weight_last_ten = abs(np.random.randn(len(X)))
sample_weight_constant = np.ones(len(X))
# and bigger weights to some outliers
sample_weight_last_ten[15:] *= 5
sample_weight_last_ten[9] *= 15

# fit the model WITH WEIGHTS
clf_weights = skgarden.quantile.RandomForestQuantileRegressor(random_state=0)
clf_weights.fit(X, y, sample_weight=sample_weight_last_ten)
弹出此错误:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-375-dfda3c67445e> in <module>
     15 # fit the model WITH WEIGHTS
     16 clf_weights = skgarden.quantile.RandomForestQuantileRegressor(random_state=0)
---> 17 clf_weights.fit(X, y, sample_weight=sample_weight_last_ten)

TypeError: fit() got an unexpected keyword argument 'sample_weight'
---------------------------------------------------------------------------
TypeError回溯(最近一次调用上次)
在里面
15#为模型配重
16 clf_权重=skgarden.quantile.RandomForestQuantileRegressor(随机_状态=0)
--->17 clf重量。拟合(X,y,样本重量=样本重量最后十次)
TypeError:fit()获得意外的关键字参数“sample\u weight”
还有什么方法可以在训练时为每个样本添加权重