You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

保险保费预测:左偏数据处理优化求助(Yeo-Johnson效果不佳)

保险保费预测中的偏态数据处理问题

我目前负责一项保险保费预测任务,特征包括职业描述、雇员数量、营业额等,正在对比K近邻(K-Nearest Neighbours)和XGBoost回归器的效果。

当前数据呈现左偏分布,以下是数据样本:

BusinessEmployedTurnoverPremium
Painter115,000£200
Builder210,000£500
Roofer525,000£200
Painter125,000£300
Builder25,000£1000

我尝试用Yeo-Johnson方法将数据转换为接近正态分布(该方法适用于偏态数据),但模型得分没有提升,希望得到处理偏态数据的建议。以下是我使用XGBoost的代码:

Data = pd.DataFrame(Data)

Data = Data.fillna(0)

Data['Quotation Status Description'] = Data["Quotation Status Description"].map({'Bound':1, "Quoted":0, "Declined":2})

Data = pd.get_dummies(Data, columns=["Job role"])

X = Data.drop('Quotation Premium Amount', axis=1)
y= Data['Quotation Premium Amount']

pt = PowerTransformer(method="yeo-johnson", standardize=True)

X_train, X_test, y_train_raw, y_test_raw = train_test_split(X,y, test_size=0.2)

y_train = pt.fit_transform(y_train_raw.values.reshape(-1, 1))
y_test = pt.transform(y_test_raw.values.reshape(-1, 1))

model=xgb.XGBRegressor(objective="reg:squarederror", eval_metric="rmse")

#define the hyperparameters
params = {"max_depth": [3, 5, 10, 20],
          "n_estimators": [250, 500,700, 1000],
          "learning_rate":[0.01, 0.015]}

#grid search
gridsearch = GridSearchCV(model, params, cv=5,scoring='neg_root_mean_squared_error', verbose=1)
gridsearch.fit(X_train, y_train)

#Best model
best_model=gridsearch.best_estimator_
y_preds =  best_model.predict(X_test)

y_pred_orig = pt.inverse_transform(y_preds.reshape(-1, 1))
y_test_orig = pt.inverse_transform(y_test.reshape(-1, 1))

#Best model
best_model=gridsearch.best_estimator_

print("R² (original):", r2_score(y_test_orig, y_pred_orig))
print("MSE:", mean_squared_error(y_test_orig, y_pred_orig))
print("RMSE:", np.sqrt(mean_squared_error(y_test_orig, y_pred_orig)))

print("Best Params: ",gridsearch.best_params_)

内容的提问来源于stack exchange,提问作者Red_bull

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 14:40:05