Saved classifier forgets its predict function
이전 댓글 표시
In a project I'm training several classifiers in Matlab 2020b, new data though should be processed in python 3.8. To do so I save the trained classifiers as .mat files (simply with "save(classifier_obj)").
In order to allow multiple users (without a matlab licence but with the runtime v9.9 installed) to use the classifiers I store these files as blob in a mysql DB (I know its not the best practice as stated here: https://de.mathworks.com/matlabcentral/answers/84154-storing-a-mat-file-in-mysql-database.).
When accessing, I download the blob file, store it temporaly on disc with these 2 lines in python and pass the file_name to the compiled matlab function (described below)
tmp = open(file_name, "wb")
tmp.write(mat)
In order to classify new data elements I've written this little function and compiled it as python code.
function label=new_classifier_predict(file_name,data)
load(file_name);
label=predict(classifier,data);
My problem now is that the classifier seems to forget its class method "predict"...
File C:\Users\steenbuck\AppData\Local\Temp\steenbuck\mcrCache9.9\new_cl0\new_classifi\classificators\new_classifier_predict.m, line 4, in new_classifier_predict
Method 'predict' is not defined for class 'ClassificationKNN' or is removed from MATLAB's search path.
I'm guessing that the object can't be reconstructed completly and therefore fails.. Strangely this error only occours when running the compiled python file. Matlab 2020b can handle all files as expected.
Is there a way to solve this or to debug and see whats happening the the matlab runtime environment?
댓글 수: 1
Johannes Steenbuck
2021년 1월 12일
편집: Johannes Steenbuck
2021년 1월 12일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Python Package Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!