Ensemble classification with Rigetti and Qiskit devices : parameters

hello, can you explain how the pre-trained parameter set (params.npy) is obtained
I have previously used Ensemble classification with Forest and Qiskit devices: Parameters from this forum, but currently it doesn’t work.

Hey @nauvan!

As I said here, the parameters here are simply obtained from minimizing a cost function akin to what’s presented in the variational classifier demo.

Basically, the predict function in the ensemble classification demo would then be fed into a cost function akin to this

def cost(trainable_parameters, X, Y):
    predictions = [model(trainable_parameters, x) for x in X]
    return square_loss(Y, predictions)

Then you can minimize cost and look at its parameters, which is what parameters.npy is in the ensemble classification demo :slight_smile:.

I want to ask. what does the error below mean. I need guidance to solve this because I am still a beginner

Hey @nauvan!

It looks like inputs is a list, which doesn’t have a softmax attribute. It’s akin to this:

l = [1, 2, 3, 4, 5] # a list
AttributeError: 'list' object has no attribute 'somethingsomething'