Пример #1
0
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
}

# print(aveAudioV, aveFumojiV, aveTextV)
print(aveAudioA, aveFumojiA, aveTextA)

# print("fumoji error:", ma.getErrorOfSeries(aveAudioV, aveFumojiV),"text error:", ma.getErrorOfSeries(aveAudioV, aveTextV))

# print("fumoji winning rate:", ma.getWinningRate(text = aveTextV, fumo = aveFumojiV, audi = aveAudioV))
ma.plotDict(data)
Пример #2
0
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')