I see a number of questions about SVM speed, but nothing about the difference between training and prediction. Here is the code for the model in question:
from sklearn.svm import SVR
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.compose import TransformedTargetRegressor
from sklearn.ensemble import BaggingRegressor
svr = SVR(C=1e-1, epsilon=0.1, tol=1e0)
pipeline = Pipeline([('scaler', StandardScaler()), ('model', svr)])
model = TransformedTargetRegressor(regressor=pipeline, transformer=StandardScaler())
model = BaggingRegressor(base_estimator=model, n_estimators=20, max_samples=1/20, n_jobs=-1)
The above is able to train on close to 500,000 samples with 50 features in well under 2 minutes, but it takes > 20 minutes to predict half as many samples. As a side note, it took close to 10 hours to train the TransformedTargetRegressor without the bagging and several hours to make the predictions. So not only is the training much faster than the prediction with bagging, but the time savings for training that comes from bagging is much greater than the time savings for prediction.
Is there anything that can be done about this? Or at the least, is there something specifically about SVM/SVR models might be causing it?