Variational Classifier Probabilities Extraction

Hi! I’m struggling to find a way to extract the “probabilities” of each result over a test or “validation” sample to change the threshold later. Perhaps this is not possible in this type of algorithms. Any suggestion?

Hi @maximer, welcome to the forum!

The variational classifier demo is made to work with expectation values. You may be able to get it to work with probabilities but you may have to make several changes on the code, and I can’t guarantee that it will work. To begin you can change the return values from ‘expval’ to ‘probs’ and see what errors arise.

Are you running into a particular error?

Thanks @CatalinaAlbornoz! I’ll try to adjust everything with the ‘probs’, but it looks like it’s not so straightforward. I’m putting a variational classifier in backtest (and soon to be in production) for a bank in LATAM, and the challenge now is to extract not just the binary outcome but the probability as well, and also find a way to do something similar to the ‘predict’ of classical ML models, so we don’t need to train each time we want to run. If you have any insights about it please share :slight_smile: .

Oh that sounds very interesting. Let me give a deeper look into this @maximer.

1 Like

Hi @maximer,

I looked into your question and realized that I’m not sure if what you’re trying to get is the probabilities of getting each state at the moment of measuring your circuit, or the closeness of a datapoint with respect to the decision boundary between the classes. I am under the impression that what you’re looking for is actually the second answer. In this case it would make most sense to find the orthogonal distance to the decision boundary by using classical methods. This can give you a sense of certainty regarding the classification you just did. I hope this is helpful and please feel free to expand your question so that I can help you find an answer that will let you move forward with your product.