Search code examples
pythonjavatensorflowscikit-learnweb-applications

how do i port my machine learning model from python to java web app?


so I've been developing some machine learning models using sklearn and tensorflow in python . and I want to integrate it into a java web app. so far I've been saving my models as .joblib any idea how i can do it ? I know this is a general question, but if someone can tell me if its possible , or do i have to retrain the models in java using java machine learning libraries a

some python code i used:

clf = MLPClassifier(solver='adam', alpha=Alpha,hidden_layer_sizes=(hid1,hid2), random_state=1,max_iter=10000)
clf.fit(x_train, y_train)

y_test_pred = clf.predict(x_test)
y_train_pred = clf.predict(x_train)

Solution

  • as @SamuelAudet said,i can integrate CPython scripts in Java applications using the JavaCPP Presets for CPython. github.com/bytedeco/javacpp-presets/tree/master/cpython