def errorCurvePotinFiveByAnnotation(talkSeries): ma = MimiAnalyser('data/test_data_extremelyPure.csv') errorV1 = pd.Series() countV1 = pd.Series() errorA1 = pd.Series() countA1 = pd.Series() for talk, sentencesInTalk in talkSeries.iteritems(): dfAudioV = ma.get_V_FrameByTalk(talk, 'Audio') dfAudioA = ma.get_A_FrameByTalk(talk, 'Audio') aveAudioV = dfAudioV.apply(np.mean, axis=0) aveAudioA = dfAudioA.apply(np.mean, axis=0) dfTextV = ma.get_V_FrameByTalk(talk, 'text') dfTextA = ma.get_A_FrameByTalk(talk, 'text') aveTextV = dfTextV.apply(np.mean, axis=0) aveTextA = dfTextA.apply(np.mean, axis=0) for i in sentencesInTalk: d = pointFive(aveAudioV[i]) eV = errorV1 cV = countV1 if eV.get(d) == None: cV.at[d] = 1 eV.at[d] = np.abs(d - pointFive(aveTextV[i])) else: cV.at[d] += 1 eV.at[d] += np.abs(d - pointFive(aveTextV[i])) for i in sentencesInTalk: d = pointFive(aveAudioA[i]) eA = errorA1 cA = countA1 if eA.get(d) == None: cA.at[d] = 1 eA.at[d] = np.abs(d - pointFive(aveTextA[i])) else: cA.at[d] += 1 eA.at[d] += np.abs(d - pointFive(aveTextA[i])) eV = eV.div(cV).sort_index() cV = cV.sort_index() eA = eA.div(cA).sort_index() cA = cA.sort_index() errorArray = [eV, eA] countArray = [cV, cA] for index, countSeries in enumerate(countArray): for label, count in countSeries.iteritems(): if count < 1: countArray[index] = countArray[index].drop(label) errorArray[index] = errorArray[index].drop(label) return [errorArray[0], errorArray[1], countArray[0], countArray[1]]
import numpy as np import pandas as pd import matplotlib.pyplot as plt from mimicry_analyser import MimiAnalyser ma = MimiAnalyser('data/test_data_filtered.csv') THE_TALK = 13 dfAudioV = ma.get_V_FrameByTalk(THE_TALK, 'Audio') dfAudioA = ma.get_A_FrameByTalk(THE_TALK, 'Audio') aveAudioV = dfAudioV.apply(np.mean, axis=0) aveAudioA = dfAudioA.apply(np.mean, axis=0) dfTextV = ma.get_V_FrameByTalk(THE_TALK, 'text') dfTextA = ma.get_A_FrameByTalk(THE_TALK, 'text') aveTextV = dfTextV.apply(np.mean, axis=0) aveTextA = dfTextA.apply(np.mean, axis=0) dfFumojiV = ma.get_V_FrameByTalk(THE_TALK, 'Fumoji') dfFumojiA = ma.get_A_FrameByTalk(THE_TALK, 'Fumoji') aveFumojiV = dfFumojiV.apply(np.mean, axis=0) aveFumojiA = dfFumojiA.apply(np.mean, axis=0) data = { "aveAudioV": aveAudioV.values, "aveFumojiV": aveFumojiV.values, "aveTextV": aveTextV.values }
import numpy as np import pandas as pd import matplotlib.pyplot as plt from mimicry_analyser import MimiAnalyser ma = MimiAnalyser('data/test_data_pure.csv') THE_TALK = 12 dfAudioV = ma.get_V_FrameByTalk(THE_TALK, 'audio') dfAudioA = ma.get_A_FrameByTalk(THE_TALK, 'audio') averageV = dfAudioV.apply(np.mean, axis=0) averageA = dfAudioA.apply(np.mean, axis=0) quadrantV = ma.getQuadrant(dfAudioV) quadrantA = ma.getQuadrant(dfAudioA) averageQV = quadrantV.apply(np.mean, axis=0) averageQA = quadrantA.apply(np.mean, axis=0) correctionQV = [] correctionQA = [] for index, r in dfAudioV.iterrows(): correctionQV.append(ma.quadrantCorrection(averageQV, r)) for index, r in dfAudioA.iterrows(): correctionQA.append(ma.quadrantCorrection(averageQA, r)) quadrantCorrectionV = pd.Series(correctionQV, index=ma.user_id[THE_TALK - 2]).sort_values() quadrantCorrectionA = pd.Series(correctionQA,
def errorCurvePotinFive(): ma = MimiAnalyser('data/test_data_extremelyPure.csv') errorV1 = pd.Series() countV1 = pd.Series() errorV2 = pd.Series() countV2 = pd.Series() errorA1 = pd.Series() countA1 = pd.Series() errorA2 = pd.Series() countA2 = pd.Series() for talk in ma.talk_id: dfAudioV = ma.get_V_FrameByTalk(talk, 'Audio') dfAudioA = ma.get_A_FrameByTalk(talk, 'Audio') aveAudioV = dfAudioV.apply(np.mean, axis=0) aveAudioA = dfAudioA.apply(np.mean, axis=0) dfTextV = ma.get_V_FrameByTalk(talk, 'text') dfTextA = ma.get_A_FrameByTalk(talk, 'text') aveTextV = dfTextV.apply(np.mean, axis=0) aveTextA = dfTextA.apply(np.mean, axis=0) for i in range(aveAudioV.size): d = pointFive(aveAudioV[i]) if aveAudioA[i] < 0: eV = errorV1 cV = countV1 elif aveAudioA[i] > 0: eV = errorV2 cV = countV2 if eV.get(d) == None: cV.at[d] = 1 eV.at[d] = np.abs(d - pointFive(aveTextV[i])) else: cV.at[d] += 1 eV.at[d] += np.abs(d - pointFive(aveTextV[i])) for i in range(aveAudioA.size): d = pointFive(aveAudioA[i]) if aveAudioV[i] < 0: eA = errorA1 cA = countA1 elif aveAudioV[i] > 0: eA = errorA2 cA = countA2 if eA.get(d) == None: cA.at[d] = 1 eA.at[d] = np.abs(d - pointFive(aveTextA[i])) else: cA.at[d] += 1 eA.at[d] += np.abs(d - pointFive(aveTextA[i])) errorV1 = errorV1.div(countV1).sort_index() countV1 = countV1.sort_index() errorA1 = errorA1.div(countA1).sort_index() countA1 = countA1.sort_index() errorV2 = errorV2.div(countV2).sort_index() countV2 = countV2.sort_index() errorA2 = errorA2.div(countA2).sort_index() countA2 = countA2.sort_index() errorArray = [errorV1, errorV2, errorA1, errorA2] countArray = [countV1, countV2, countA1, countA2] for index, countSeries in enumerate(countArray): for label, count in countSeries.iteritems(): if count < 3: countArray[index] = countArray[index].drop(label) errorArray[index] = errorArray[index].drop(label) data = { 'when Arousal < 0': errorArray[0], 'when Arousal > 0': errorArray[1] } ma.plotDict(data, 'error of Valence') data = { 'when Valence < 0': errorArray[2], 'when Valence > 0': errorArray[3] } ma.plotDict(data, 'error of Arousal')