Beispiel #1
0
            processPool=processPool,
            featureName=settingsDict['Feature Name'],
            numFeatures=int(settingsDict['Number of Features']),
            downSampleFactor=int(settingsDict['Feature DownSample Factor']),
            timeDelay=int(settingsDict['CRP Time Delay']),
            dimension=int(settingsDict['CRP Dimension']),
            method=settingsDict['CRP Method'],
            neighbourhoodSize=settingsDict['CRP Neighbourhood Size'],
            runType='validation',
            sequenceLength=int(settingsDict['NCD Sequence Length']),
            weightMatrix=weightMatrix,
            biases=biases,
            featureOffset=featureOffset,
            featureScaling=featureScaling,
            timeStacking=int(settingsDict['NN Time Stacking']))

        # Convert NCD files into a dataframe
        dfNCDs = convertNCDfiles(dataFrameFileName=settingsDict['Run Name'])

        # Get the overall MAP of the run and add to the setting
        MAPresult = getDataFrameMAPresult(dfNCDs)
        if MAPresult is not None:
            print 'Mean Average Precision: %0.3f\n' % MAPresult
        else:
            print 'No MAP result found!'
        settingsDict['Mean Average Precision'] = MAPresult
        settingsDict['Run Duration'] = datetime.now() - startDateTime

        # Save run settings and result
        pickle.dump(settingsDict, open(resultsFn, 'wb'))
Beispiel #2
0
                               featureName, setting['DownSample Factor'],
                               setting['Time Delay'], setting['Dimension'], CRPmethod, setting['Neighbourhood Size'], 
                               numFilesPerFolder, setting['Sequence Length'], 
                               weightMatrix, biases, featureOffset, featureScaling)
                # create and save a record of the run settings
                runDict = {'featureName': featureName,
                           'method': CRPmethod, 
                           'numFilesPerFolder': numFilesPerFolder,
                           'networkType': NNtype}
                for key in setting.keys():
                    runDict[key] = setting[key]
                runTime = str(datetime.now()).replace(':', '-')
                pickle.dump(runDict, open(runHistoryPath + runTime + '.pkl', 'wb'))
                
                # Convert NCD files into a dataframe
                dfNCDs = convertNCDfiles(dataFrameFileName = runTime)

                # Create subfolders and move results files into them
                NCDdest = NCDpath + subFolder + '/'
                runHistDest = runHistoryPath + subFolder + '/'
                createPath(NCDdest)
                createPath(runHistDest)
                moveFiles(NCDpath, NCDdest, '.pkl.res')
                moveFiles(runHistoryPath, runHistDest, '.pkl')
                
                # Get the overall MAP of the run and add to the setting
                MAPresult = getDataFrameMAPresult(dfNCDs)
                if MAPresult is not None:
                    print 'Mean Average Precision: %0.3f\n' % MAPresult
                else:
                    print 'No MAP result found!'
Beispiel #3
0
deleteNCDPickleFiles()

existingNCDs = None
processPool = Pool(numProcesses)

for downSampleFactor in downSampleFactors[::-1]:
    for neighbourhoodSize in CRPneighbourhoodSizes:
        for method in CRPmethods:
            for dimension in CRPdimensions:
                for timeDelay in CRPtimeDelays:
                    for sequenceLength in sequenceLengths:

                        createNCDfiles(existingNCDs, processPool,
                                       featureName, downSampleFactor,
                                       timeDelay, dimension, method, neighbourhoodSize, 
                                       numFilesPerFolder, sequenceLength)
    
                        runDict = {'featureName': featureName,
                                   'downSampleFactor': downSampleFactor,
                                   'timeDelay': timeDelay, 
                                   'dimension': dimension,
                                   'method': method, 
                                   'neighbourhoodSize': neighbourhoodSize,
                                   'numFilesPerFolder': numFilesPerFolder,
                                   'sequenceLength': sequenceLength}
    
                        runTime = str(datetime.now()).replace(':', '-')
                        pickle.dump(runDict, open(runHistoryPath + runTime + '.pkl', 'wb'))
                        convertNCDfiles(runTime)