from sklearn.svm import SVR
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score

scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

reg_svr = SVR(kernel='rbf')
reg_svr.fit(X_train_scaled, y_train)

test['prediction_svr'] = reg_svr.predict(X_test_scaled)

score_svr = np.sqrt(mean_squared_error(test['PJME_MW'], test['prediction_svr']))
print(f'RMSE Score on Test set (SVR): {score_svr:0.2f}')
  • 1
    $\begingroup$ If you offer a reprex, that will make it easier to obtain a useful answer. $\endgroup$
    – J_H
    Commented Apr 7 at 4:22
  • 1
    $\begingroup$ It is difficult to answer the question based on the information that you provide. E.g., it would be important to know what kind of dataset you are considering (how many features, how many data records). Also "taking much time" is not clear (is it minutes or hours, are you comparing to another method, or is it in comparison to a benchmark test?). Providing all these information will make a useful answer much more likely. $\endgroup$
    – BanDoP
    Commented Apr 7 at 10:31

1 Answer 1


There are several possibilities to speed up your SVM training. Follow the steps mentioned in the answer



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.