Example #1
0
                                int(settingsDict['Feature DownSample Factor']),
                                int(settingsDict['CRP Time Delay']),
                                int(settingsDict['CRP Dimension']),
                                settingsDict['CRP Method'],
                                settingsDict['CRP Neighbourhood Size'],
                                None,
                                None,
                                int(settingsDict['NCD Sequence Length']),
                                featureFileDict=featureFileDict,
                                pieceIds=pieceIds)

        # Convert NCD files into a dataframe
        runTime = str(datetime.now()).replace(':', '-')
        MAPresult = None
        if NCDlist is None:  # there were errors e.g. in CRP calculation after downsampling
            MAPresult = 0  # need to use something that is not None for the optimiser to find its best result
        else:
            dfNCDs = convertNCDs(NCDlist, dataFrameFileName=None)
            # Get the overall MAP of the run and add to the setting
            print 'Calculating MAP Result...'
            MAPresult = getDataFrameMAPresult(dfNCDs)
        if MAPresult is not None and MAPresult != 0:
            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'))
Example #2
0
                                        setting['DownSample Factor'],
                                        setting['Time Delay'],
                                        setting['Dimension'], CRPmethod,
                                        setting['Neighbourhood Size'],
                                        numFolders, numFilesPerFolder,
                                        setting['Sequence Length'],
                                        weightMatrix, biases, featureOffset,
                                        featureScaling, timeStacking)

                # Convert NCD files into a dataframe
                runTime = str(datetime.now()).replace(':', '-')
                MAPresult = None
                if NCDlist is None:  # there were errors e.g. in CRP calculation after downsampling
                    MAPresult = 0  # need to use something that is not None for the optimiser to find its best result
                else:
                    dfNCDs = convertNCDs(NCDlist, dataFrameFileName=runTime)
                    # Get the overall MAP of the run and add to the setting
                    MAPresult = getDataFrameMAPresult(dfNCDs)
                if MAPresult is not None and MAPresult != 0:
                    print 'Mean Average Precision: %0.3f\n' % MAPresult
                else:
                    print 'No MAP result found!'
                setting['Mean Average Precision'] = MAPresult

                # Create and save a runDict of the settings and result
                # assign single (non-optimised) settings to the runDict
                runDict = {
                    'featureName': featureName,
                    'method': CRPmethod,
                    'numFilesPerFolder': numFilesPerFolder
                }