Using MLPregressor to get the confidence vector of MLPclassifier

Dear all

Someone asked on our GitHub if it was possible for FluidMLPClassifier to provide its confidence vector. The answer is that there is another way: since the MLP code is the same under the hood, one can load a model made in the classifier in the regressor and get access to the output vector, in effect a histogram of how much each class is likely to be the right one.

Here it is in Max first - I am using the demo code from the classifier tutorial. I will code the SC version later from the video code again.

classification-video-demo+vector-from-regressor.maxpat (20.2 KB)

and here is the SC code. First download the code from the video and run it so you have a classifier working: Classifying Sounds using a Neural Network in SuperCollider - YouTube

then use this and it works mightily!

// import the classifier state as a dictionary
~nn.dump{|i|~nn_dump = i}

// check the content - there is a dictionary called mlp

// make a regressor
~reg = FluidMLPRegressor(s)
// load the fitted state

//check it works
~confidences = Buffer.alloc(s,2);

~reg.predictPoint(~mfccbuf, ~confidences, {
1 Like