Ejemplo n.º 1
0
def executeOneSetting(matrix, density, roundId, para):
    logger.info('density=%.2f, %2d-round starts.' % (density, roundId + 1))

    # remove data matrix
    (trainMatrix, testMatrix) = evallib.removeEntries(matrix, density, roundId)

    # QoS prediction
    startTime = time.clock()  # to record the running time for one round

    predictedMatrix1 = UIPCC.UPCC(trainMatrix, para)
    predictedMatrix2 = UIPCC.IPCC(trainMatrix, para)
    predictedMatrix = UIPCC.UIPCC(trainMatrix, predictedMatrix1,
                                  predictedMatrix2, para)

    runningTime = float(time.clock() - startTime)

    # evaluate the estimation error
    evalResult = evallib.evaluate(testMatrix, predictedMatrix, para)
    result = (evalResult, runningTime)

    # dump the result at each density
    outFile = '%s%s_%s_result_%.2f_round%02d.tmp' % (
        para['outPath'], para['dataName'], para['dataType'], density,
        roundId + 1)
    evallib.dumpresult(outFile, result)

    logger.info('density=%.2f, %2d-round done.' % (density, roundId + 1))
    logger.info('----------------------------------------------')
Ejemplo n.º 2
0
def executeOneSetting(matrix, density, roundId, para):
    logger.info('density=%.2f, %2d-round starts.'%(density, roundId + 1))
    
    # remove data matrix
    (trainMatrix, testMatrix) = evallib.removeEntries(matrix, density, roundId)

    # QoS prediction
    startTime = time.clock() # to record the running time for one round             
    predictedMatrix = NMF.predict(trainMatrix, para) 
    runningTime = float(time.clock() - startTime)

    # evaluate the estimation error  
    evalResult = evallib.evaluate(testMatrix, predictedMatrix, para)
    result = (evalResult, runningTime)

    # dump the result at each density
    outFile = '%s%s_%s_result_%.2f_round%02d.tmp'%(para['outPath'], para['dataName'], 
        para['dataType'], density, roundId + 1)
    evallib.dumpresult(outFile, result)
    
    logger.info('density=%.2f, %2d-round done.'%(density, roundId + 1))
    logger.info('----------------------------------------------')