File size: 1,226 Bytes
28183db
 
 
 
 
 
 
 
 
 
 
 
 
 
021a052
28183db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import streamlit as st
import pandas as pd

covariate_columns = {
    'content_domain': 'Content Domain',
    'language': 'Language',
    'rater_group': 'Rater Group',
}

id_vars = [
    'mean_z', 'text', 'content_domain', 'language', 
    'rater_group', 'study', 'instrument'
]

def load_data():
    st.session_state.df = (
        pd
        .read_feather(path='data.feather')
        .query('partition == "test" | partition == "dev"')
        .melt(
            value_vars=['sentiment_model', 'desirability_model'],
            var_name='x_group',
            value_name='x',
            id_vars=id_vars
            )
        .replace(
            to_replace={
                'en': 'English',
                'de': 'German',
                'other': 'Other',
                'personality': 'Personality',
                'laypeople': 'Laypeople',
                'students': 'Students',
                'sentiment_model': 'Sentiment Model',
                'desirability_model': 'Desirability Model'
            }    
        )
        .rename(columns=covariate_columns)
        .rename(
            columns={
                'mean_z': 'Human-ratings',
                'x': 'Machine-ratings',
            }
        )
    )