コード例 #1
0
#########################################################

## Quantum K-Means

#########################################################

print 'Initiating QK-Means...'

qk_results=list()
qk_rounds_genNum=list() #list with the number of generations of each round
for i in range(numRounds):

    start = datetime.now()

    qk_centroids,qk_assignment,fitnessEvolution,qk_timings_cg,qk_db_timings=QK_Means.qk_means(mixture,numOracles,numClusters,qubitStringLen,qGenerations,dim,timeDB=True,earlyStop=earlyStop)
    qk_results.append([qk_centroids,qk_assignment,fitnessEvolution,qk_timings_cg,qk_db_timings])

    round=(datetime.now() - start).total_seconds()
    print float(i+1)*100/numRounds,'%\t','round ', i,':',round,'s  -  estimated:',(float(numRounds-1)-i)*round,'s / ',(float(numRounds-1)-i)*round/60,'m'

    qk_rounds_genNum.append(fitnessEvolution.shape[0]) #number of generations of current round



#########################################################
print 'Preparing data structures...'

qk_rounds=dict()
qk_rounds['centroids']=list()
qk_rounds['assignment']=list()
コード例 #2
0
del parser

#########################################################

## Quantum K-Means

#########################################################

print 'Initiating QK-Means...'

qk_results = list()
for i in range(numRounds):

    start = datetime.now()

    qk_centroids, qk_assignment, fitnessEvolution, qk_timings_cg = QK_Means.qk_means(
        mixture, numOracles, numClusters, qubitStringLen, qGenerations, dim)
    qk_results.append(
        [qk_centroids, qk_assignment, fitnessEvolution, qk_timings_cg])

    round = (datetime.now() - start).total_seconds()
    print float(
        i + 1
    ) * 100 / numRounds, '%\t', 'round ', i, ':', round, 's  -  estimated:', (
        float(numRounds - 1) - i) * round, 's / ', (float(numRounds - 1) -
                                                    i) * round / 60, 'm'

#########################################################
print 'Preparing data structures...'

qk_rounds = dict()
qk_rounds['centroids'] = list()
コード例 #3
0
ファイル: testBench.py プロジェクト: Chiroptera/ThesisWriting
del parser

#########################################################

## Quantum K-Means

#########################################################

print 'Initiating QK-Means...'

qk_results=list()
for i in range(numRounds):

    start = datetime.now()

    qk_centroids,qk_assignment,fitnessEvolution,qk_timings_cg=QK_Means.qk_means(mixture,numOracles,numClusters,qubitStringLen,qGenerations,dim)
    qk_results.append([qk_centroids,qk_assignment,fitnessEvolution,qk_timings_cg])

    round=(datetime.now() - start).total_seconds()
    print float(i+1)*100/numRounds,'%\t','round ', i,':',round,'s  -  estimated:',(float(numRounds-1)-i)*round,'s / ',(float(numRounds-1)-i)*round/60,'m'



#########################################################
print 'Preparing data structures...'

qk_rounds=dict()
qk_rounds['centroids']=list()
qk_rounds['assignment']=list()
qk_rounds['fitness']=list()
qk_rounds['times']=list()
コード例 #4
0
ファイル: testBench2.py プロジェクト: diogo-aos/masters_final
#########################################################

print 'Initiating QK-Means...'

qk_results = list()
qk_rounds_genNum = list()  #list with the number of generations of each round
for i in range(numRounds):

    start = datetime.now()

    qk_centroids, qk_assignment, fitnessEvolution, qk_timings_cg, qk_db_timings = QK_Means.qk_means(
        mixture,
        numOracles,
        numClusters,
        qubitStringLen,
        qGenerations,
        dim,
        timeDB=True,
        earlyStop=earlyStop)
    qk_results.append([
        qk_centroids, qk_assignment, fitnessEvolution, qk_timings_cg,
        qk_db_timings
    ])

    round = (datetime.now() - start).total_seconds()
    print float(
        i + 1
    ) * 100 / numRounds, '%\t', 'round ', i, ':', round, 's  -  estimated:', (
        float(numRounds - 1) - i) * round, 's / ', (float(numRounds - 1) -
                                                    i) * round / 60, 'm'