Model saving and loading
steveoni opened this issue · comments
Is your feature request related to a problem? Please describe.
How are models plan to be save and loaded
Describe the solution you'd like
I think we can have a fromJson
and toJson
to save and load model params and weight. if this is needed i can start working on that
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
This is perfect. This definitely the next step for this repo. I'll make an issue and assign you to it.
What's the format of the JSON object? As an example, let's say I train a linear regression. What should we save in the JSON?
@dcrescim we can save the model params and weight in json, and we can also load the model from the json params.
for linear regression we can decide to save the weight and bias, and if it contains a regularizer, we can save that also.
@steveoni Makes sense to me! My only thought regarding the serialization of models was that we use the keys in the sklearn parameters / attributes. So for example, let's take KMeans (https://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html)
Basically if we serialize the JSON as
{
name: 'KMeans',
n_clusters: 8,
init: 'kmeans',
// other constructor params
cluster_centers_: [[1, 2], [3,4]],
labels_: [0,1,2]
// other class attributes
}
Then we could "read" serialized sklearn estimators, as well as our own serialized models with the same code. What do you think?