Beispiel #1
0
def experiment(n,new_offset=0,s1="eh",s2="es",s3="nl",s4="mh"):
    global offset,slots

    if all(list(map(lambda x: isinstance(x,str),[s1,s2,s3,s4]))):
        s1 = s1.lower()
        s2 = s2.lower()
        s3 = s3.lower()
        s4 = s4.lower()

        if s1 in [s2,s3,s4] or s2 in [s1,s3,s4] or s3 in [s1,s2,s4] or s4 in [s1, s2, s3]:
            actr.print_warning("Duplicate slot names provided. Using default slots.")
            slots = ["eh", "es", "nl", "mh"]
        elif 'category' in [s1,s2,s3,s4]:
            actr.print_warning("Slot named category cannot be used. Using default slots.")
            slots = ["eh", "es", "nl", "mh"]
        else:
            slots=[s1,s2,s3,s4]
    else:
        actr.print_warning("Not all slot names provided are strings. Using default slots.")
        slots = ["eh", "es", "nl", "mh"]

    if isinstance(new_offset,numbers.Number):
        offset = new_offset
    else:
        offset = 0

    trials = len(cat_data)

    results = [0] * trials
    counts = [0] * trials

    for i in range(n):
        answers,responses = do_experiment()
        results = list(map(lambda x,y: x + y,results,answers))
        counts = list(map(lambda x,y: x + y,counts,responses))

    results=list(map(lambda x: x/n,results))

    offset = 0

    actr.correlation(results,cat_data)
    actr.mean_deviation(results,cat_data)

    print("P(C=1)")
    print("        ",end="")
    for i in range(trials):
        print("(%4d) " % counts[i],end="")
    print()
    print("data  ",end="")
    for i in range(trials):
        print("%7.3f" % cat_data[i],end="")
    print()
    print("model ",end="")
    for i in range(trials):
        print("%7.3f" % results[i],end="")
    print()
Beispiel #2
0
def print_results(predicted, data, label):

    print()
    print(label)
    actr.correlation(predicted, data)
    actr.mean_deviation(predicted, data)
    print("Trial    1       2       3       4       5       6       7       8")
    print("     ", end='')
    for i in predicted:
        print('%8.3f' % i, end='')
    print()
Beispiel #3
0
def display_results(results):

    questions = ["1+1","1+2","1+3","2+2","2+3","3+3"]

    actr.correlation(results,siegler_data)
    actr.mean_deviation(results,siegler_data)


    print("       0     1     2     3     4     5     6     7     8   Other")
    for i in range(6):
        print(questions[i],end="")
        
        for j in range(10):
            print("%6.2f" % results[i][j],end="")
        print()
def compare(n):
    rts = [0, 0, 0, 0, 0, 0, 0, 0, 0]
    counts = [0, 0, 0, 0, 0, 0, 0, 0, 0]

    for i in range(n):
        r, c = experiment(False, False)
        rts = list(map(lambda x, y: x + y, rts, r))
        counts = list(map(lambda x, y: x + y, counts, c))

    rts = list(map(lambda x: x / n, rts))
    counts = list(map(lambda x: x / n, counts))

    actr.correlation(rts, control_data)
    actr.mean_deviation(rts, control_data)

    print_analysis(rts, counts, [1, 2, 3], ['2', '3', '4'], [192, 192, 192])
def experiment(n, human=False):
    l = len(test_stim)

    result = [0] * l
    p_values = [["decide-over", 0], ["decide-under", 0], ["force-over", 0],
                ["force-under", 0]]
    for i in range(n):
        actr.reset()
        d = bst_set(human, vis=True, stims=test_stim)
        for j in range(l):
            if d[j] == "over":
                result[j] += 1

        actr.hide_output()

        # for p in p_values:
        #     p[1] += production_u_value(p[0])

        actr.unhide_output()

    result = list(map(lambda x: 100 * x / n, result))

    if len(result) == len(exp_data):
        actr.correlation(result, exp_data)
        actr.mean_deviation(result, exp_data)

    print()
    print("Trial ", end="")
    for i in range(l):
        print("%-8d" % (i + 1), end="")
    print()

    print("  ", end="")
    for i in range(l):
        print("%8.2f" % result[i], end="")

    print()
    print()

    for p in p_values:
        print("%-12s: %6.4f" % (p[0], p[1] / n))
Beispiel #6
0
def output_person_location(data):

    rts = list(map(lambda x: x[0], data))

    actr.correlation(rts, person_location_data)
    actr.mean_deviation(rts, person_location_data)

    print("\nTARGETS:\n                         Person fan")
    print("  Location      1             2             3")
    print("    fan")

    for i in range(3):
        print("     %d      " % (i + 1), end="")
        for j in range(3):
            print("%6.3f (%-5s)" % (data[j + (i * 3)]), end="")
        print()

    print()
    print("FOILS:")
    for i in range(3):
        print("     %d      " % (i + 1), end="")
        for j in range(3):
            print("%6.3f (%-5s)" % (data[j + ((i + 3) * 3)]), end="")
        print()
Beispiel #7
0
def report_data(data):

    actr.correlation(data, exp_data)
    actr.mean_deviation(data, exp_data)
    print_results(data)