XGBresressor 中的 P 值 [重复]

问题描述 投票:0回答:1

如何计算 XGBregressor 和 SVR 中的 p 值? 建议的方法是 Bonferroni 的方法。我知道调整后的 p 值 = min{1,原始 p 值 * 特征数}。事实上,我不知道如何计算 p 值。

python regression probability xgboost xgbregressor
1个回答
0
投票

你可以这样做(这是一个例子):

from sklearn.datasets import fetch_california_housing
from sklearn.feature_selection import f_regression
import xgboost as xgb

california_housing = fetch_california_housing(as_frame=True)

X, y = california_housing.data, california_housing.target
xgb_reg = xgb.XGBRegressor()
xgb_reg.fit(X, y)

f_vals, p_vals = f_regression(X, y)

feat_idx = 0

raw_p_val = p_vals[feat_idx]
num_features = X.shape[1]

adj_p_val = min(1, raw_p_val * num_features)

print("Raw p-value:", raw_p_val)
print("Adjusted p-value:", adj_p_val)

哪个给

Raw p-value: 0.0
Adjusted p-value: 0.0
© www.soinside.com 2019 - 2024. All rights reserved.