I have created a pipeline model mixing scikit learn preprocessing and keras.
scaler = StandardScaler()
clf = KerasRegressor(build_fn=build_model,epochs=1000,validation_split=0.2, batch_size=100, callbacks=[print_dot,plot_losses], verbose=1)))
pipeline = Pipeline([
('preprocess',scaler),
('clf',clf)
])
import time
start = time.time()
pipeline.fit(X_train,y_train)
end = time.time()
print(end-start)
This code works and I can call the transform pipeline method as well
predictions = pipeline.predict(X_test).flatten()
The problem is I need to save Pipeline as an HD5 model so that non-pre-processed values can be given to the model during runtime -
Is this possible if not what is the method of hosting this pipeline?
So the question below only solves the problem of saving just the model without the pre-processing pipeline - I want to save the pre-processing pipeline as well -
How to save Scikit-Learn-Keras Model into a Persistence File (pickle/hd5/json/yaml)
@danyfang was helpful in finding this question
how to save a scikit-learn pipline with keras regressor inside to disk?
The problem it stores pipeline as .pkl file separately. So need to see how pk1 is converted to pmml