from sklearn.svm import SVR
steps = [
('scaler', RobustScaler()),
('svr', SVR()),
]
np.random.seed(0)
reg_svr = Pipeline(steps=steps)
reg_svr.fit(x_train, y_train)
predictions = reg_svr.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
===================================
MSE 1197.8 1167.3 736.0
R2 0.68183 0.68992 0.80450
score inf inf inf