Undefined function 'predict' for input arguments of type 'table' for Python package (with Matlab Compiler).

I am getting the error "Undefined function 'predict' for input arguments of type 'table'" when I try to execute the function that I packaged for Python. The function should predict based on a trained SVM model (edit: I used 'templateSVM' and 'fitcecoc' functions). I am sure my inputs are all correct, the input is not a table format, it is a matrix of type double, all of the necessary dimensions of the matrix are correct too. The function works when I run it from Matlab directly, but fails when I call it from Python, giving me the error above. Could this be a licensing issue? Although I read that with application deployment of Statistics and Machine Learning Toolbox functionality no additional licenses are required if you used command line functions.

3 Commenti

Hi Al, I am also getting same error while making dll integration for .net. Did you find any solution or reason for that error.
Actually I did find the solution after looking through a bunch of posts. In my understanding it doesn't have to do with your data, it is an error that Matlab gives when there's a issue with license or it doesn't know which function to use with your data.
The issue is when you package your trained model, you don't specify from what 'class' this model comes from. You need to specify the class from which your trained model came from in the function that you package. In my case I'm using the 'fitcecoc' function from 'ClassificationECOC' class, so the top two lines of my packaged function look like this:
function CF = classify_features()
%#function ClassificationECOC
the second line is where I'm saying what class the model is from. It seems that the documentation for this is not great and you have to look around for solutions.
hi Al, thank you so much for your answer. your fast reply really made a lot work. I also saw similar solutions from other posts but they weren't clear.

Accedi per commentare.

Categorie

Richiesto:

AI
il 18 Giu 2018

Commentato:

il 3 Lug 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by