Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 3
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()
qk_rounds['assignment']=list()
qk_rounds['fitness']=list()
qk_rounds['times']=list()
Exemplo n.º 4
0
#########################################################

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'