I have a python function as the following
from sklearn.preprocessing import QuantileTransformerimport numpy as npdef fit_transform(fitting_matrix, new_matrix): transformer = QuantileTransformer(output_distribution='uniform') transformer.fit(fitting_matrix) return transformer.transform(new_matrix)if __name__ == '__main__': # Generating some sample data matrix_one = np.random.rand(100, 1) * 10 matrix_two = np.random.rand(10, 1) * 10 print(fit_transform(matrix_one, matrix_two))The above function receives a fitting_matrix to fit the QuantileTransformer and receives another matrix new_matrix to be transformed.
Now I want to call the fit_transform function in Java.And I have asked chatgpt, and chatgpt suggested the following method
- JNI
- JNA
- package python file into
.sofile and call that .so file in java
None of the above three methods work. So, please, How to call the above python function in java?