from xgboost import XGBRegressor
steps = [
("scaler", RobustScaler()),
("xgb", XGBRegressor()),
]
reg_xgb = Pipeline(steps=steps)
reg_xgb.fit(x_train, y_train)
predictions = reg_xgb.predict(x_val)
plt.figure()
plt.scatter(y_val, predictions, s=5, alpha=0.2)
plt.xlabel('RUL (true)')
plt.ylabel('RUL')
predictions[predictions < 1] = 1
print('MSE', mean_squared_error(y_val, predictions))
print('R2', r2_score(y_val, predictions))
print('score', custom_loss(y_val, predictions))
Linear ElasticNet SVR xgboost
===========================================
MSE 1197.8 1167.3 736.0 840.3
R2 0.6818 0.6899 0.8045 0.7768
score inf inf inf inf