Commit d5699b5e authored by Prathisha Kunnumbrath Manden's avatar Prathisha Kunnumbrath Manden
Browse files

Experiment results, automated experiment 3 analysis

parent 7bb27b9d
Grid Size,Max Colors,Move Position / Row,Avalanche count,Score per Move
"(5, 5)",4,0,0.558208955,5.029850746
"(5, 5)",4,1,0.670520231,5.867052023
"(5, 5)",4,2,0.768229167,6.5859375
"(5, 5)",4,3,0.933944954,7.126605505
"(5, 5)",4,4,0.828220859,6.349693252
"(5, 5)",5,0,0.248041775,3.908616188
"(5, 5)",5,1,0.522807018,5.019298246
"(5, 5)",5,2,0.481392557,4.99759904
"(5, 5)",5,3,0.526522593,4.960707269
"(5, 5)",5,4,0.468164794,4.786516854
"(5, 5)",8,0,0.209359606,3.450738916
"(5, 5)",8,1,0.176043557,3.470054446
"(5, 5)",8,2,0.210596026,3.688741722
"(5, 5)",8,3,0.254473161,3.745526839
"(5, 5)",8,4,0.335463259,3.75399361
"(5, 5)",10,0,0.153061224,3.265306122
"(5, 5)",10,1,0.163636364,3.334545455
"(5, 5)",10,2,0.143742255,3.371747212
"(5, 5)",10,3,0.177514793,3.380670611
"(5, 5)",10,4,0.209230769,3.350769231
"(7, 7)",5,0,0.38,4.444
"(7, 7)",5,1,0.45915493,4.828169014
"(7, 7)",5,2,0.57790927,5.483234714
"(7, 7)",5,3,0.629554656,5.593117409
"(7, 7)",5,4,0.782110092,6.46559633
"(7, 7)",5,5,0.811074919,6.35504886
"(7, 7)",5,6,0.790322581,6.408602151
"(7, 7)",8,0,0.172661871,3.528776978
"(7, 7)",8,1,0.19,3.595
"(7, 7)",8,2,0.246956522,3.822608696
"(7, 7)",8,3,0.219178082,3.780821918
"(7, 7)",8,4,0.294871795,4.017094017
"(7, 7)",8,5,0.327526132,4.135888502
"(7, 7)",8,6,0.323741007,4.115107914
"(7, 7)",10,0,0.163822526,3.389078498
"(7, 7)",10,1,0.185279188,3.530456853
"(7, 7)",10,2,0.154296875,3.447265625
"(7, 7)",10,3,0.181425486,3.56587473
"(7, 7)",10,4,0.169154229,3.60199005
"(7, 7)",10,5,0.179401993,3.531561462
"(7, 7)",10,6,0.208333333,3.476190476
"(7, 7)",12,0,0.138709677,3.203225806
"(7, 7)",12,1,0.122994652,3.248663102
"(7, 7)",12,2,0.124045802,3.286259542
"(7, 7)",12,3,0.135746606,3.309954751
"(7, 7)",12,4,0.182278481,3.458227848
"(7, 7)",12,5,0.166666667,3.448979592
"(7, 7)",12,6,0.227272727,3.443181818
"(7, 7)",15,0,0.155555556,3.155555556
"(7, 7)",15,1,0.127027027,3.181081081
"(7, 7)",15,2,0.090909091,3.132231405
"(7, 7)",15,3,0.131147541,3.276346604
"(7, 7)",15,4,0.131004367,3.268558952
"(7, 7)",15,5,0.14,3.186666667
"(7, 7)",15,6,0.23902439,3.331707317
"(7, 7)",20,0,0.163120567,3.106382979
"(7, 7)",20,1,0.116959064,3.067251462
"(7, 7)",20,2,0.098501071,3.145610278
"(7, 7)",20,3,0.095918367,3.120408163
"(7, 7)",20,4,0.13064133,3.16152019
"(7, 7)",20,5,0.098802395,3.092814371
"(7, 7)",20,6,0.231155779,3.201005025
"(10, 10)",5,0,0.333333333,4.273809524
"(10, 10)",5,1,0.482758621,5.159482759
"(10, 10)",5,2,0.703821656,6.143312102
"(10, 10)",5,3,0.758122744,6.198555957
"(10, 10)",5,4,1.086466165,7.962406015
"(10, 10)",5,5,1.033333333,7.953333333
"(10, 10)",5,6,1.119133574,8.433212996
"(10, 10)",5,7,1.110714286,8.328571429
"(10, 10)",5,8,1.278761062,9.115044248
"(10, 10)",5,9,1.330508475,9.161016949
"(10, 10)",8,0,0.127272727,3.422727273
"(10, 10)",8,1,0.189285714,3.660714286
"(10, 10)",8,2,0.1769437,3.699731903
"(10, 10)",8,3,0.263157895,4.002770083
"(10, 10)",8,4,0.253012048,3.972891566
"(10, 10)",8,5,0.254612546,3.970479705
"(10, 10)",8,6,0.316742081,4.262443439
"(10, 10)",8,7,0.31147541,4.180327869
"(10, 10)",8,8,0.321637427,4.298245614
"(10, 10)",8,9,0.3125,4.270833333
"(10, 10)",10,0,0.12,3.43
"(10, 10)",10,1,0.166112957,3.564784053
"(10, 10)",10,2,0.135135135,3.5
"(10, 10)",10,3,0.168571429,3.577142857
"(10, 10)",10,4,0.138297872,3.443262411
"(10, 10)",10,5,0.261538462,3.923076923
"(10, 10)",10,6,0.209964413,3.754448399
"(10, 10)",10,7,0.25,3.873015873
"(10, 10)",10,8,0.290322581,3.88172043
"(10, 10)",10,9,0.297297297,3.882882883
"(10, 10)",15,0,0.148351648,3.32967033
"(10, 10)",15,1,0.159090909,3.352272727
"(10, 10)",15,2,0.092178771,3.296089385
"(10, 10)",15,3,0.144230769,3.288461538
"(10, 10)",15,4,0.116838488,3.250859107
"(10, 10)",15,5,0.181494662,3.419928826
"(10, 10)",15,6,0.137546468,3.371747212
"(10, 10)",15,7,0.140740741,3.348148148
"(10, 10)",15,8,0.177339901,3.413793103
"(10, 10)",15,9,0.303278689,3.573770492
"(10, 10)",20,0,0.177419355,3.215053763
"(10, 10)",20,1,0.127413127,3.200772201
"(10, 10)",20,2,0.116147309,3.101983003
"(10, 10)",20,3,0.109375,3.190625
"(10, 10)",20,4,0.140794224,3.231046931
"(10, 10)",20,5,0.104247104,3.204633205
"(10, 10)",20,6,0.152416357,3.241635688
"(10, 10)",20,7,0.113879004,3.163701068
"(10, 10)",20,8,0.149484536,3.180412371
"(10, 10)",20,9,0.21641791,3.380597015
"(10, 10)",25,0,0.135135135,3.151351351
"(10, 10)",25,1,0.1125,3.0875
"(10, 10)",25,2,0.105633803,3.133802817
"(10, 10)",25,3,0.093457944,3.105919003
"(10, 10)",25,4,0.129449838,3.197411003
"(10, 10)",25,5,0.115942029,3.148550725
"(10, 10)",25,6,0.095238095,3.113553114
"(10, 10)",25,7,0.104529617,3.128919861
"(10, 10)",25,8,0.112745098,3.093137255
"(10, 10)",25,9,0.172661871,3.09352518
"(10, 10)",30,0,0.122994652,3.101604278
"(10, 10)",30,1,0.125,3.0625
"(10, 10)",30,2,0.121580547,3.05775076
"(10, 10)",30,3,0.098039216,3.08496732
"(10, 10)",30,4,0.107692308,3.1
"(10, 10)",30,5,0.10130719,3.071895425
"(10, 10)",30,6,0.109965636,3.089347079
"(10, 10)",30,7,0.127272727,3.123636364
"(10, 10)",30,8,0.126315789,3.131578947
"(10, 10)",30,9,0.186440678,3.084745763
"(15, 15)",6,0,0,3
"(15, 15)",6,1,0,3
"(15, 15)",6,2,0.4,5.6
"(15, 15)",6,3,0.5,6.166666667
"(15, 15)",6,4,0.333333333,4
"(15, 15)",6,5,1.333333333,8
"(15, 15)",6,6,2,9
"(15, 15)",6,7,0.333333333,4.333333333
"(15, 15)",6,8,1.75,14
"(15, 15)",6,9,0,3
"(15, 15)",6,10,1.2,9
"(15, 15)",6,11,0,3
"(15, 15)",6,12,1.666666667,11
"(15, 15)",6,13,1,6
"(15, 15)",6,14,0,3
"(15, 15)",8,0,0.111888112,3.405594406
"(15, 15)",8,1,0.209876543,3.864197531
"(15, 15)",8,2,0.177083333,3.739583333
"(15, 15)",8,3,0.207407407,3.844444444
"(15, 15)",8,4,0.268817204,4.078853047
"(15, 15)",8,5,0.298245614,4.147368421
"(15, 15)",8,6,0.460144928,4.753623188
"(15, 15)",8,7,0.361607143,4.366071429
"(15, 15)",8,8,0.394067797,4.555084746
"(15, 15)",8,9,0.402777778,4.550925926
"(15, 15)",8,10,0.611814346,5.611814346
"(15, 15)",8,11,0.580487805,5.312195122
"(15, 15)",8,12,0.545,5.035
"(15, 15)",8,13,0.60625,5.55
"(15, 15)",8,14,0.711111111,5.988888889
"(15, 15)",10,0,0.122641509,3.481132075
"(15, 15)",10,1,0.090909091,3.371212121
"(15, 15)",10,2,0.146892655,3.553672316
"(15, 15)",10,3,0.198830409,3.725146199
"(15, 15)",10,4,0.18404908,3.680981595
"(15, 15)",10,5,0.207692308,3.669230769
"(15, 15)",10,6,0.316666667,4.116666667
"(15, 15)",10,7,0.271929825,4.043859649
"(15, 15)",10,8,0.290598291,4.213675214
"(15, 15)",10,9,0.227722772,3.732673267
"(15, 15)",10,10,0.37,4.23
"(15, 15)",10,11,0.359550562,4.505617978
"(15, 15)",10,12,0.488636364,4.613636364
"(15, 15)",10,13,0.35483871,4.677419355
"(15, 15)",10,14,0.575757576,4.848484848
"(15, 15)",12,0,0.120689655,3.448275862
"(15, 15)",12,1,0.11971831,3.464788732
"(15, 15)",12,2,0.052631579,3.210526316
"(15, 15)",12,3,0.157894737,3.532894737
"(15, 15)",12,4,0.158273381,3.611510791
"(15, 15)",12,5,0.1796875,3.6171875
"(15, 15)",12,6,0.175,3.575
"(15, 15)",12,7,0.243478261,3.87826087
"(15, 15)",12,8,0.128205128,3.478632479
"(15, 15)",12,9,0.244897959,3.887755102
"(15, 15)",12,10,0.180851064,3.542553191
"(15, 15)",12,11,0.322222222,4.433333333
"(15, 15)",12,12,0.157303371,3.606741573
"(15, 15)",12,13,0.202898551,3.811594203
"(15, 15)",12,14,0.382978723,4.723404255
"(15, 15)",15,0,0.063157895,3.157894737
"(15, 15)",15,1,0.2,3.644444444
"(15, 15)",15,2,0.068493151,3.191780822
"(15, 15)",15,3,0.144067797,3.36440678
"(15, 15)",15,4,0.128205128,3.5
"(15, 15)",15,5,0.115942029,3.362318841
"(15, 15)",15,6,0.123893805,3.380530973
"(15, 15)",15,7,0.112068966,3.344827586
"(15, 15)",15,8,0.158333333,3.483333333
"(15, 15)",15,9,0.126126126,3.342342342
"(15, 15)",15,10,0.213592233,3.805825243
"(15, 15)",15,11,0.142857143,3.582417582
"(15, 15)",15,12,0.218390805,3.528735632
"(15, 15)",15,13,0.291666667,3.861111111
"(15, 15)",15,14,0.315789474,3.789473684
"(15, 15)",18,0,0.092307692,3.138461538
"(15, 15)",18,1,0.09009009,3.396396396
"(15, 15)",18,2,0.02919708,3.058394161
"(15, 15)",18,3,0.091603053,3.213740458
"(15, 15)",18,4,0.090909091,3.265734266
"(15, 15)",18,5,0.125984252,3.31496063
"(15, 15)",18,6,0.114754098,3.286885246
"(15, 15)",18,7,0.188034188,3.683760684
"(15, 15)",18,8,0.099173554,3.388429752
"(15, 15)",18,9,0.117647059,3.420168067
"(15, 15)",18,10,0.198198198,3.585585586
"(15, 15)",18,11,0.127118644,3.36440678
"(15, 15)",18,12,0.142857143,3.307692308
"(15, 15)",18,13,0.213333333,3.453333333
"(15, 15)",18,14,0.149253731,3.313432836
"(15, 15)",20,0,0.148648649,3.162162162
"(15, 15)",20,1,0.129310345,3.344827586
"(15, 15)",20,2,0.107142857,3.392857143
"(15, 15)",20,3,0.086956522,3.217391304
"(15, 15)",20,4,0.080645161,3.177419355
"(15, 15)",20,5,0.107438017,3.198347107
"(15, 15)",20,6,0.123809524,3.304761905
"(15, 15)",20,7,0.114583333,3.177083333
"(15, 15)",20,8,0.078947368,3.192982456
"(15, 15)",20,9,0.14516129,3.290322581
"(15, 15)",20,10,0.11,3.27
"(15, 15)",20,11,0.125,3.275
"(15, 15)",20,12,0.179775281,3.449438202
"(15, 15)",20,13,0.208791209,3.428571429
"(15, 15)",20,14,0.228070175,3.631578947
"(15, 15)",25,0,0.211267606,3.126760563
"(15, 15)",25,1,0.080291971,3.153284672
"(15, 15)",25,2,0.1,3.261538462
"(15, 15)",25,3,0.078740157,3.165354331
"(15, 15)",25,4,0.063492063,3.166666667
"(15, 15)",25,5,0.118181818,3.245454545
"(15, 15)",25,6,0.178861789,3.398373984
"(15, 15)",25,7,0.102803738,3.23364486
"(15, 15)",25,8,0.141732283,3.165354331
"(15, 15)",25,9,0.107142857,3.25
"(15, 15)",25,10,0.138211382,3.284552846
"(15, 15)",25,11,0.169491525,3.271186441
"(15, 15)",25,12,0.163043478,3.402173913
"(15, 15)",25,13,0.095238095,3.095238095
"(15, 15)",25,14,0.295081967,3.295081967
"(15, 15)",30,0,0.2,3.0625
"(15, 15)",30,1,0.102803738,3.214953271
"(15, 15)",30,2,0.098484848,3.098484848
"(15, 15)",30,3,0.084615385,3.146153846
"(15, 15)",30,4,0.123966942,3.20661157
"(15, 15)",30,5,0.108333333,3.15
"(15, 15)",30,6,0.111111111,3.238095238
"(15, 15)",30,7,0.100917431,3.256880734
"(15, 15)",30,8,0.107142857,3.133928571
"(15, 15)",30,9,0.053097345,3.168141593
"(15, 15)",30,10,0.119266055,3.220183486
"(15, 15)",30,11,0.133333333,3.162962963
"(15, 15)",30,12,0.102803738,3.224299065
"(15, 15)",30,13,0.081081081,3.081081081
"(15, 15)",30,14,0.333333333,3.333333333
\ No newline at end of file
import csv
import os
import pandas as pd
from scipy.stats import spearmanr
df = pd.read_csv('exp_game_results_3.csv')
# grid_sizes = ['(5, 5)', '(7, 7)', '(10, 10)', '(15, 15)', '(20, 20)']
input_data = pd.read_csv('exp_3_game_setting.csv')
max_colors = input_data['color_end'].unique().tolist()
grid_sizes = input_data['grid_size'].unique().tolist()
for size in grid_sizes:
grid_size = '(' + size + ')'
rows = int(grid_size.split(',', 1)[0].replace('(', ""))
for max_color in max_colors:
data_1 = df[(df['Grid Size'] == grid_size) & (df['Max Colors'] == max_color)]
if not data_1.empty:
for row in range(rows):
# print(row)
data = data_1[(data_1['Selected Move'].str.contains(r'\[\(' + str(row) + ', .\), \(' + str(row) + ', .\)\]'))]
row_avalanche = data['Avalanche per selected move'].mean()
row_score = data['Move Score'].mean()
file_exists = os.path.isfile("exp_3_analysis.csv")
with open('exp_3_analysis.csv', 'a+', newline='') as csv_file:
fieldnames = ['Grid Size',
'Max Colors',
'Move Position / Row',
'Avalanche count',
'Score per Move']
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
if not file_exists:
writer.writeheader()
writer.writerow({'Grid Size': grid_size,
'Max Colors': max_color,
'Move Position / Row': row,
'Avalanche count': row_avalanche,
'Score per Move': row_score})
dataframe = pd.read_csv('exp_3_analysis.csv')
for size in grid_sizes:
grid_size = '(' + size + ')'
rows = int(grid_size.split(',', 1)[0].replace('(', ""))
for max_color in max_colors:
df_1 = dataframe[(dataframe['Grid Size'] == grid_size) & (dataframe['Max Colors'] == max_color)]
if not df_1.empty:
x = df_1['Move Position / Row']
y = df_1['Score per Move']
corr, _ = spearmanr(x, y)
print(f'Spearmans correlation for {rows} x {rows} grid with max {max_color} colors: {corr:.3f}')
grid_size,color_end
"5, 5",4
"5, 5",5
"5, 5",8
"5, 5",10
"7, 7",5
"7, 7",8
"7, 7",10
"7, 7",12
"7, 7",15
"7, 7",20
"10, 10",5
"10, 10",8
"10, 10",10
"10, 10",15
"10, 10",20
"10, 10",25
"10, 10",30
"15, 15",6
"15, 15",8
"15, 15",10
"15, 15",12
"15, 15",15
"15, 15",18
"15, 15",20
"15, 15",25
"15, 15",30
\ No newline at end of file
......@@ -448,9 +448,9 @@ if __name__ == "__main__":
agent = Agent()
# play for number of times configured
Parallel(n_jobs=num_cores, require='sharedmem')(delayed(play)() for i in range(experiment_repeat))
# for i in range(experiment_repeat):
# logging.debug("\tRepeating experiment " + str(i + 1) + " of " + str(experiment_repeat) + " times.")
# play()
# Parallel(n_jobs=num_cores, require='sharedmem')(delayed(play)() for i in range(experiment_repeat))
for i in range(experiment_repeat):
# logging.debug("\tRepeating experiment " + str(i + 1) + " of " + str(experiment_repeat) + " times.")
play()
experiment.store_experiment_1_result(board_size, color_range_end)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment