1

我正在尝试使用分位数回归使用 CatBoostRegressor 生成预测区间。据我所知,预测区间不能为负。但是,以下代码会产生(一些)负区间:

data = sklearn.datasets.load_boston()
X = pd.DataFrame(data['data'])
y = pd.Series(data['target'])
X_train, X_test, y_train, y_test = train_test_split(X,y)

cbr_upper = CatBoostRegressor(loss_function='Quantile:alpha=0.95')
cbr_lower = CatBoostRegressor(loss_function='Quantile:alpha=0.05')

cbr_upper.fit(X_train, y_train, verbose=500)
cbr_lower.fit(X_train, y_train, verbose=500)

y_upper = cbr_upper.predict(X_test)
y_lower = cbr_lower.predict(X_test)

interval_list = y_upper - y_lower

sum(interval_list < 0)

6

这怎么可能?

4

0 回答 0