Closed ikrambennasrbennasr closed 5 years ago
Hello @ikrambennasrbennasr
The import_model
method does not return anything and works like this:
disaggregator.import_model("model-redd5.h5")
predictions = disaggregator.disaggregate_chunk(A_batch)
This should fix the error.
Thanks @OdysseasKr for your response. In fact, that's what i did and it worked. But I did not understand the usefulness of the import method, if it does not import the model. What I understood, and it's up to you to correct me of course, that the export method allows us to export the model in the form of hdf5 or pkl, so that we can import it afterwards and apply the method disaggregate_chunk without doing the training of the algorithm again. So the question here is what is the utility of the import method if it does not have an output? Thanks a lot.
the export method allows us to export the model in the form of hdf5 or pkl, so that we can import it afterwards and apply the method disaggregate_chunk without doing the training of the algorithm again.
This is correct! The import_model
method does not return a new variable but it sets the internal attributes of the dissagregator
. So, after calling the method, the disaggregator
variable has loaded the model from the file and is trained and ready to go.
Please note that exporting the model works only with hdf5 files and not with pkl.
@OdysseasKr Thanks a lot for the explanation, I get it.
Hello Odyssea, when applying the method export_model after training my model:
disaggregator.export_model("model-redd5.h5")
I try to import this model by doing :
cls = disaggregator.import_model("model-redd5.h5") predictions = cls.disaggregate_chunk(A_batch)
but by doing that, it returns that cls has no method disaggregate_chunk. To predict test values, i have to train every time my model. So how can i use the method import_model for the disaggregation, without doing the training every time I need to predict test values.
Thanks