irllabs / ml-lib

A machine learning library for Max and Pure Data
Other
274 stars 40 forks source link

ml.svm probs error #186

Open kieranmaraj opened 1 year ago

kieranmaraj commented 1 year ago

Hi there!

I'm trying to use the ml.svm object in Max 8.5.3 on MacOS 10.14.6. In general it works fantastically, but I'm having an issue getting the probabilities to output from the object. I'm reading in a model that I've already trained and then sending the object a probs 1 message. From there, whenever I try to send a 'map' message, I get the console message: 'error: ml.svm: labels / likelihoods size mismatch.' I'm not sure what I'm doing wrong - if I work with the ml.svm in the help patch, I'm able to get probability output there without an issue.

Any help with this is super appreciated!

NiccoloGranieri commented 1 year ago

Hi @kieranmaraj, thanks for using ml.lib.

As the error says, this is due to a mismatch between the size of the label and the likelihoods. Having said this, I was not able to replicate the error on my machine. Could you please create a minimal patch that exhibits the error and send it over?

kieranmaraj commented 1 year ago

It seems that the error only occurs when reading a trained model into the object. When I train a model and then give it a 'probs 1' message, it works as intended. If I write the model, then read it, sending the 'probs 1' message produces the above error. This seems to be the case with any model, but I've attached the .model and .data files for one of the models I'm working with.

svm-model.zip

kieranmaraj commented 1 year ago

And a very simple patch to demonstrate:

svm-test.zip

NiccoloGranieri commented 1 year ago

Hi @kieranmaraj , thanks for reporting this. I can confirm that I can reproduce the error with the code and training data you provided, and even with simpler classification tasks with 2 classes alone.

I will mark this issue as a bug, but unfortunately we are not actively working on ml.lib anymore. It might take some time before this fix makes it into a new release.