irllabs / ml-lib

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

32 bit or 64 bit? ml.svm Probabilities #149

Closed sandcobainer closed 5 years ago

sandcobainer commented 5 years ago

Unique situation here. I'm using the ml.svm object to classify gestures. Using MacOS High Sierra, Max 7 and 64bit The classification works fine in 64 bit but does not give probability of the classification as the object "mxj list.Demultiplex 2" is not supported by the JVM. Returns with "unable to create JVM." This is because Max's mxj object does not support 64 bit.

Switched to 32 bit, and the ml.svm object is not found entirely. Returns "mach-o, but wrong architecture".

So inorder to make probablities work, are there any other workarounds? the mxj list.Demultiplex 2 object in ml.svm.maxhelp is a Java class for demultiplex, but there is a similar object in Jit. jit.demultiplex. I will try fiddling around, but an input from your guys here would help.

Thanks.

jamiebullock commented 5 years ago

Hi @sandcobainer, thanks for your interest in ml-lib.

You certainly don't need any Java objects to access the probabilities. [route] and [unpack] will do the job nicely.

See attached example.

Let me know if this solves your issue.

svm-probs.maxpat.zip

sandcobainer commented 5 years ago

Hey Jamie, thank you for looking into this. Your example worked perfectly. But I'm not able to reproduce your patch with mine. So there isn't really anything wrong with the probs attribute. It is frustrating at the least. Any leads are welcome. https://media.giphy.com/media/MuGiLvJtlCNyOuSjo0/giphy.gif

jamiebullock commented 5 years ago

Hi, that gif is too blurry to really see what's going on, but I'm happy to take a look if you send the patch. Or DM me on Twitter @jamiebullock if you want to send it privately.

sandcobainer commented 5 years ago

I'm sorry. You'll need hardware to reproduce that patch. I'm using a Leap Motion to classify gestures.

The max patch in the gifs is at https://github.com/sandcobainer/gesturalmusicinterfaces/blob/master/theremingesture/gestural-midi-interface.maxpat . The machine learning model is inside a p left-gesture specifically.

NiccoloGranieri commented 5 years ago

Hi @sandcobainer, it looks like you simply forgot to enable the probability output from the right outlet. If you try and feed a (probs 1) message to your ml.svm object, once trained, you'll receive the probability values out of the right outlet. In the example patch @jamiebullock previously provided, he was doing that automatically by using the loadbang object on the (probs 1) message.

Tested on Max 7 (64bit), macOS Mojave 10.14.3

jamiebullock commented 5 years ago

Closing due to no reply.