# State bug in IBM Quantum Experience

I run many tests with VQC and QSVM algorithms. In last times I can't get final result because some job hang on state Creating, Validating or Running. It can continue many hours and It doesn't finish. For example, I run test with some parameters and get result but after I run test with the same parameters and not get result because this problem. It happens with real devices and qasm_simulator. For QSVM These problems happen after long time (>1000 jobs), for VQC - in the beginning. Does it are problems of site or my code? Sorry for my english.

My code:

import warnings
import numpy as np
from qiskit.aqua import QuantumInstance
from qiskit.aqua.algorithms import VQC
from qiskit.aqua.components.optimizers import SPSA, COBYLA
from qiskit.aqua.components.feature_maps import RawFeatureVector
from qiskit.circuit.library import TwoLocal, ZZFeatureMap
from qiskit import IBMQ

#I read file where data look so:
#1234
#28313
#2145
#27216
#...

def get_bd(str):
f = open(str,'r')
_true = []
_false = []
for i in range(3):
m = []
a,none,data = data.partition('\n')
b,none,data = data.partition('\n')
m.append(int(a))
m.append(int(b))
_false.append(m)

for i in range(3):
m = []
a,none,data = data.partition('\n')
b,none,data = data.partition('\n')
m.append(int(a))
m.append(int(b))
_true.append(m)
return _false, _true

def get_tr(name,n):
f = open(name,'r')
test = []
for i in range(n):
m = []
a,none,data = data.partition('\n')
b,none,data = data.partition('\n')
m.append(int(a))
m.append(int(b))
test.append(m)
return test

train_false,train_true = get_bd('spectrain.txt')
test_false,test_true = get_bd('spectest.txt')

warnings.filterwarnings("ignore", category=DeprecationWarning)

provider = IBMQ.get_provider(hub='ibm-q')

shots = 8192
feature_dim = 2
backend = provider.get_backend('ibmq_qasm_simulator')
optimizer = SPSA(max_trials=1000, c0=4.0, skip_calibration=True)
optimizer.set_options(save_steps=1)
#feature_map = RawFeatureVector(feature_dimension=feature_dim)
feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2,entanglement='linear')
#feature_map = SecondOrderExpansion(feature_dimension=2,depth=2,entanglement='linear')

var_form = TwoLocal(feature_dim, ['ry', 'rz'], 'cz', reps=3)

training_data = {'A': np.asarray(train_false),'B': np.asarray(train_true)}
#test_false,test_true = get_bd('test_data')
testing_data = {'A': np.asarray(test_false),'B': np.asarray(test_true)}

vqc = VQC(optimizer, feature_map, var_form, training_data, testing_data)
quantum_instance = QuantumInstance(backend, shots=shots,skip_qobj_validation=False)

result = vqc.run(quantum_instance)
print("testing success ratio: ", result['testing_accuracy'])


Hmm. I run it today on trainning samples in 3-norm,3-anomaly samples and It doesn't hang... while. So yesterday It worked in first time until I run training for 1000-norm,1000-anomaly samples where problem happens. I try to run 1000-norm,1000-anomaly samples later for checking.

Update 21.11.2020 I try run VQC algorithm 1000-norm,1000-anomaly samples and get this:

Some jobs were completed but It hangs now. I get good result with this test yesterday. Today I set 8192 shots (It was 2 shots in last time) and We see this image.

• If you can put your code here then I can run it myself to see whether I will run into the same issue or not. I have had a particular job hang in queue for a long time and wasn't going anywhere... I usually just cancel it and Aqua will resubmit my job for me. – KAJ226 Nov 19 '20 at 22:47
• I try to cancel it but It repeated with other jobs again and again. Validating error happens sometimes after it so. – Kirill Nov 20 '20 at 9:02