I have recently confronted with a (at least for me) new kind of ML problem, where the output of the model should be a vector/matrix (depending on the interpretation, but there is no difference actually), not a scalar as usual. This is totally unknown for me. What kind of approach should one apply here? Are the "usual" (scalar-based) models applicable on this problem?

(Just for the sake of completeness, the problem is an image segmentation task where the model should decide first: if there a given pattern on the picture?, second: if so, where is it? - In latter case, it should define the borders of the subset pixels).


Neural Networks can have a vector or matrix as output layer, image segmentation is a well researched topic and deep learning (as most things concerning images) are the state-of-the-art. You will need (a lot of) training examples where the pattern is found, and where. This could be a bounding box, or per pixel if it is part of the pattern or not (this will generate a matrix equally sized to your input). To see if the pattern is found you could construct a second network that is just a binary classifier, or you could try to see if your pixel-based network will output almost only zeros in case of no pattern. In this case you will need negative examples as well.

  • $\begingroup$ Thanks, that sounds reassuring. But I have scan through Scikit-Learn's Neural Network Regressor page and I couldn't catch any parameter to define which kind of output is required. Similarly, I cannot see any hint how could I feed multiple training data sets (one for the image itself and another with the masks of recognized patterns) into the model. Besides, I have read a handful of papers and tutorials about Convolutional NNs, but these tend to be too challenging for me at the moment (the methods involve Keras, Tensorflow and other unknown libraries). $\endgroup$
    – Hendrik
    Jul 18 '16 at 9:50
  • $\begingroup$ Scikit-learn has a very limited neural network offering, you will not be able to do these things with it unfortunately. Without convolutional neural networks this is going to be very challenging. My advice would be to invest more time in CNNs and learn Keras (it's a lot less difficult than it looks at first). $\endgroup$ Jul 18 '16 at 9:51
  • $\begingroup$ An alternative is to learn n different classifiers where n is the size of your output vector. This approach suffers from not really learning the dependencies between the outputs but does allow you to use sklearn only $\endgroup$ Jul 18 '16 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.