Author: Andrei Stefan
Date: 09-11-2023
Required files: data/anonymised_data/anonymised_data_post_questionnaire.csv, data/constructsMean_14agents.csv
Output files: no output files
This file contains the code to reproduce the results for the ASA questionnaire. The corresponding figure is Figure 4.8 (indirectly, because it is created with the ASA chart tool, and here is where we get the data to use).
# import all required packages
import pandas as pd
In the post questionnaire, people are asked to fill in the ASA questionnaire. Here, we calculate the final score for each of the questions and compare them with the scores of ASAs that are similar to ours.
def asa():
"""
Function to calculate the ASA means per item for Jamie, the score for Jamie, and the necessary data for generating the
ASA charts for Jamie compared to Siri and HAL 9000.
Args: none.
Returns: none.
"""
# read the responses to the ASA questionnaire for Jamie into a dataframe
df_jamie = pd.read_csv("../../../data/anonymised_data/anonymised_data_post_questionnaire.csv")
# initialise a list which will hold the means for each of the questions
means = []
# loop over question indices
for i in range(1, 25):
# calculate the mean score of the question
mean = df_jamie.loc[:, f'ASA_{i}'].mean()
# add the mean score to the list of means
means.append(mean)
# flip the means for the reversed questions: 12, 17, 18, 22
means[11] = - means[11]
means[16] = - means[16]
means[17] = - means[17]
means[21] = - means[21]
# print the list of means
print("The means for Jamie are", means)
# print the score for Jamie
print("ASA score for Jamie is", sum(means))
# read the mean scored of the other 14 ASAs into a datafram
df_others = pd.read_csv("../../../data/constructsMean_14agents.csv", index_col=0)
# calculate their scores
df_others['Score'] = df_others[df_others.columns.difference(['ASA'])].sum(axis=1)
# print the ASAs that are similar to Jamie (check the ASA short version paper for criteria)
print("Similar ASAs in terms of communication mode are Siri and HAL 9000")
# Print the scores of Siri and HAL 9000
print(df_others[df_others['ASA'].isin(['SIRI', 'HAL 9000'])][['ASA', 'Score']])
# print their means
print("Their means per item are:")
means_others = df_others[df_others['ASA'].isin(['SIRI', 'HAL 9000'])][df_others.columns.difference(['ASA', 'Score'])].values.tolist()
print("HAL 9000", means_others[0])
print("SIRI", means_others[1])
asa()
The means for Jamie are [-0.8, 0.2636363636363636, -0.07272727272727272, -0.2909090909090909, 0.8363636363636363, 2.0272727272727273, 1.6727272727272726, 1.1090909090909091, 0.13636363636363635, -0.20909090909090908, 0.5363636363636364, 0.6272727272727273, 0.6272727272727273, 0.5272727272727272, 0.01818181818181818, 0.8, 1.6636363636363636, 1.690909090909091, 1.1090909090909091, -0.4727272727272727, 0.08181818181818182, -0.7090909090909091, -0.39090909090909093, -0.8454545454545455] ASA score for Jamie is 9.936363636363637 Similar ASAs in terms of communication mode are Siri and HAL 9000 ASA Score 7 HAL 9000 13.67 12 SIRI 12.63 Their means per item are: HAL 9000 [-2.08, 0.23, -1.2, -0.36, 1.39, 1.39, 1.18, 0.36, 0.05, 0.29, 1.36, 0.86, 2.12, 0.41, 0.84, 2.1, 1.61, 1.8, 0.41, -0.26, 0.75, -1.06, 0.8, 0.68] SIRI [-1.76, -0.28, -0.7, -0.81, 0.8, 2.21, 2.07, 0.77, -0.14, -0.64, 2.13, 1.53, 1.56, 1.17, 0.57, 1.79, 2.08, 0.79, 2.03, -0.99, 0.93, -1.91, -0.62, 0.05]