def getTranscribedPatterns(ptr = ['TA', 'TA', 'KI', 'TA']): """ Gets the transcribed sequences for the pattern (ptr) provided bsed on the onset information in the transcribed data. """ result = [] l = len(ptr) # Getting the masterdata config = ut.loadConfig('/home/swapnil/SMC/MasterThesis/gitPercPatterns/code/rlcs/config') transFolder = config['transFolder'] #transFolder = '/home/swapnil/Desktop/temp' lblDir = config['lblDir'] onsDir = config['onsDir'] masterData = ut.getAllSylbData(tPath = transFolder, lblDir = lblDir, onsDir = onsDir) # Find the start and the end point of patters in for comp in masterData: compName = comp[2] print 'Working for composition:' + compName transScore = comp[0][0] transOnset = comp[0][1] origScore = comp[1][0] origOnset = comp[1][1] # Get the starting indices for the pattern in the composition comp ptrStartIndices = ut.getSubstringPos(origScore, ptr) # Get the dictionaries of set for the indices of patterns in the ground truth dictPtrIndices = populateDictPtrIndices(ptrStartIndices, l) # Get the closest set onsets for the pattern in the transcription ptrIndicesInTrans = getIndicesInTrans(origOnset, transOnset, dictPtrIndices) ptrnsInTrans = getPatternsInTrans(transScore, ptrIndicesInTrans) result.append((compName, ptrnsInTrans)) return result
baseline = True #similarityListFile = os.path.join(sylbSimFolder,'simMatList.txt') #similarityList = [line.strip().split('.')[0] for line in open(similarityListFile)] # For correctness check #similarityList = ['TablaDB_3_kmeans_mahal'] # looks promising .... #similarityList = ['KLMonteCarlo-5','KLMonteCarlo-6', 'KLMonteCarlo-7'] # looks promising .... #similarityList = ['KLGaussApprox-3', 'KLGaussApprox-4', 'KLGaussApprox-5', 'KLGaussApprox-6', 'KLGaussApprox-7'] # looks promising .... similarityList = ['binaryDistance'] # results without similarity ignrSimList = ['TablaDB_10_GMM_euclidean'] simObject = None masterData = ut.getAllSylbData(tPath = transFolder, lblDir = lblDir, onsDir = onsDir) #simDict = ut.getSimilarityDict('/home/swapnil/SMC/MasterThesis/sylbSimilarity/TablaDBstrokes','/home/swapnil/SMC/MasterThesis/sylbSimilarity/results_mat/TablaDB_6_kmeans_euclidean.mat') def getAccuracies(payload, tres = 70.0, fp = None): #fo.write('run.getAccuracies::') totalRelvRetrieved = 0 totalRetrieved = 0 totalRelevant = 0 totalRelvRetrievedInGt = 0 ptrInTransLen = [] # List for the length of all the patterns that are the candidate patterns for inst in payload: retrieved = inst[0]