def exp1_follow_up():
    alpha = exp1_alpha()
    learning_set, probabilities, categories, number_of_categories = experiment_1.get_experiment1_setup(
    )
    beta = 0.1
    n_trials = 2000

    p = Simulation(learning_set, probabilities, categories,
                   number_of_categories, "prefix", alpha, beta, n_trials)
    prefix_weights = p.simulate()

    s = Simulation(learning_set, probabilities, categories,
                   number_of_categories, "suffix", alpha, beta, n_trials)
    suffix_weights = s.simulate()

    # Figure 5.1 in thesis
    plots.exp1_plt_weights(prefix_weights, 1)
    plots.exp1_plt_weights(suffix_weights, 2)
    plt.show()

    # Experiment 1 plot raw weights at test: Figure 5.2 panel A in thesis
    test_features = [0]
    test_trials = [49, 99, 499, 999, 1499, 1999]
    labels = ["50", "100", "500", "1000", "1500", "2000"]
    prefix_averaged_weights = testmodel.averaged_weights(
        prefix_weights, learning_set, probabilities, categories,
        number_of_categories, "prefix", alpha, beta, n_trials)
    suffix_averaged_weights = testmodel.averaged_weights(
        suffix_weights, learning_set, probabilities, categories,
        number_of_categories, "suffix", alpha, beta, n_trials)

    # Prefix
    prefix_correct_weights = prefix_averaged_weights[:, 0]
    prefix_incorrect_weights = prefix_averaged_weights[:, 1]
    prefix_results = testmodel.sums(test_features, test_trials,
                                    prefix_correct_weights,
                                    prefix_incorrect_weights)

    # Suffix
    suffix_correct_weights = suffix_averaged_weights[:, 0]
    suffix_incorrect_weights = suffix_averaged_weights[:, 1]
    suffix_results = testmodel.sums(test_features, test_trials,
                                    suffix_correct_weights,
                                    suffix_incorrect_weights)

    plots.plt_sum_intervals(prefix_results, 1, len(test_trials), labels)
    plots.plt_sum_intervals(suffix_results, 2, len(test_trials), labels)
    plt.show()

    # Plot Luce's choice axiom results: Figure 5.2 panel B in thesis
    prefix_500 = prefix_results[:, 2]
    suffix_500 = suffix_results[:, 2]
    sum_weights = [prefix_500, suffix_500]
    sum_weights = np.transpose(np.stack(sum_weights))

    prob_correct = testmodel.luces_choice(sum_weights)
    plots.plt_luce(prob_correct)
    plt.show()
Exemple #2
0
    def plot_thesis(self):
        w_hf, w_lf, prob_correct_hf, prob_correct_lf = self.get_results()

        plots.plt_sum(w_hf, -0.5, 4)  # Figure 4.3 panel A in thesis
        plt.show()

        plots.plt_sum(w_lf, -0.1, 1.6)  # Figure 4.3 panel B in thesis
        plt.show()

        plots.plt_luce(prob_correct_hf)  # Figure 4.3 panel C in thesis
        plt.show()

        plots.plt_luce(prob_correct_lf)  # Figure 4.3 panel D in thesis
        plt.show()
Exemple #3
0
def exp3_raw_weights_lf():
    test_features = [1, 3]
    test_trials = [6999]
    w_lf = exp3_test_raw(test_features, test_trials)
    return w_lf


if __name__ == '__main__':
    exp3_weights_fig()

    w_hf = exp3_raw_weights_hf()
    w_lf = exp3_raw_weights_lf()

    # Experiment 3 plot sum of raw weights at test: Figure 4.3 panel A in thesis
    plots.plt_sum(w_hf, -0.1, 1.6)
    plt.show()

    # Experiment 3 plot Luce's choice axiom results: Figure 4.3 panel C in thesis
    prob_correct_hf = testmodel.luces_choice(w_hf)
    plots.plt_luce(prob_correct_hf)
    plt.show()

    # Experiment 3 plot sum of raw weights at test: Figure 4.3 panel B in thesis
    plots.plt_sum(w_lf, -0.1, 1.6)
    plt.show()

    # Experiment 3 plot Luce's choice axiom results: Figure 4.3 panel D in thesis
    prob_correct_lf = testmodel.luces_choice(w_lf)
    plots.plt_luce(prob_correct_lf)
    plt.show()
def exp1_luces_fig():
    # Experiment 1 plot Luce's choice axiom results: Figure 3.3 panel B in thesis
    prob_correct = testmodel.luces_choice(w)
    plots.plt_luce(prob_correct)
    plt.show()