# Filtering a set of results obtained from job manager

I've already generated a filter for readout error mitigation:

cal_results = cal_job.result()
meas_fitter = CompleteMeasFitter(cal_results, state_labels)
fig, ax = plt.subplots(figsize=(10, 10))
meas_fitter.plot_calibration(ax)
meas_filter = meas_fitter.filter


I have a set of circuits executed using the IBM job manager, the list is called all_circuits. After transpling the list, I tried:

MExperiments = job_manager.run(all_circuits, backend=backend, shots = nshots)
results = MExperiments.results()
**mitigated_results = meas_filter.apply(results)**


I'm hoping to use the filter to mitigate the errors for each circuit in the list, but the last line doesn't quite work. It shows me

QiskitError: 'Unrecognized type for raw_data.'


How can I fix this issue? Thanks:)

$$\rule{4cm}{0.4pt}$$

PS: From the tutorial, there're 4 types of raw data that match the requirement:

Form1: A counts dictionary from results.get_counts,

Form2: A list of counts of length=len(state_labels),

Form3: A list of counts of length=M*len(state_labels) where M is an integer (e.g. for use with the tomography data),

Form4: A qiskit Result.

I'm not pretty sure why the results in my code doesn't fit any one of them.

• You can use type(results) to find out why results doesn't fit any of the four allowed types. This may also give you ideas about how to convert the value to whatever apply expects. – Adam Zalcman Feb 7 at 21:31
• @Adam Zalcman Thank you for the comment! I tried that command and it shows me the type is 'qiskit.providers.ibmq.managed.managedresults.ManagedResults' It looks like the parameters for apply should be a dictionary or list. I'm not pretty sure how I can convert the results – ZR- Feb 7 at 21:57
• @Adam Zalcman I just solved the issue. Thanks!! – ZR- Feb 8 at 0:03
• Cool! Consider answering your own question. It might help someone in future. – Adam Zalcman Feb 8 at 0:04
• @Adam Zalcman Sounds good! I'll do that:) – ZR- Feb 8 at 0:05

As mentioned above, there're 4 types of data that match the requirement. The results in this case obtained from the job manager is not the same as the results shown in the tutorial since it contains a set of results from different quantum circuits. (I'm still confused why this is not considered as a qiskit result, i.e Form 4 above.)

As I tried to print the type, it shows meqiskit.providers.ibmq.managed.managedresults.ManagedResults . Then I searched more information from here. There's a method called combine_results() that allows us to combine results from all jobs into a single Result, which is the same result in the tutorial's example. So I just did:

MExperiments = job_manager.run(all_circuits, backend=backend, shots = nshots)
results = MExperiments.results()
cresults = results.combine_results()
mitigated_results = meas_filter.apply(cresults)

• Ha. I forgot about that there is a combine_result method... I have been loop through all my results and combine them manually... :) – KAJ226 Feb 8 at 0:51
• @KAJ226 Haha thanks!! Yeah I didn't know that, it's really fun to explore the 'method library' :-) – ZR- Feb 8 at 0:55
• @KAJ226 Oops.. I just found we might not be able to combine the results if the circuit list gets too large. It shows me 'Results cannot be combined since some of the jobs failed.' In my job status ., however, it shows all the jobs have been successfully executed. Do you know why this happens? -:) – ZR- Feb 8 at 1:08
• No, I don't, unfortunately. :( – KAJ226 Feb 8 at 1:46
• @KAJ226 Haha thanks though:) – ZR- Feb 8 at 2:03