'Load .sav file in android studio

I have trained a model using the following code and saved the model in .sav format.

from sklearn.tree import DecisionTreeClassifier
import pickle

tree = DecisionTreeClassifier(criterion = 'entropy', random_state=0)
tree.fit(X_train, Y_train)

filename = 'DecisionTreeClassifier.sav'
pickle.dump(tree, open(filename, 'wb'))

Now I want to load the model in android studio using java code. Is it possible to load the model in Android and predict? If not how can I train a sklearn model in python and load it in android studio and predict?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source