def draw_tries_log_solved_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.array(np.log10(solved)), np.array(tries), xlbl="log10(solved)", ylbl="avg_tries", xlim=(None, None), ylim=(0, 20), alphas=[0.01])
def draw_log_solved_level_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.log10(np.array(solved)), np.array(level), xlbl="log10(solved)", ylbl="level", alphas=[0.05], trend_func=axb, ttl="level - log(solved)")
def draw_tries_solved_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.array(solved), np.array(tries), xlbl="solved", ylbl="avg_tries", xlim=(0, 15000), ylim=(0, 20), alphas=[0.01])
def draw_solved_level_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.array(solved), np.array(level), xlbl="solved", ylbl="level", xlim=(None, 50000), alphas=[0.03], ttl="level - solved")
def draw_log_tries_log_solved_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.array(np.log10(solved)), np.array(np.log10(tries)), xlbl="log10(solved)", ylbl="log10(avg_tries)", xlim=(None, 5), ylim=(None, 1.5), alphas=[0.02])
def draw_log_tries_level_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.array(np.log10(tries)), np.array(level), xlbl="log10(avg_tries)", ylbl="level", ylim=(0, 30), alphas=[0.02], trend_func=axb, ttl="level - log(avg_tries)")
def draw_tries_level_plot(dirname): level, solved, tries = read_csvs(dirname) plot_trend(np.array(tries), np.array(level), xlbl="avg_tries", ylbl="level", xlim=(0, 15), ylim=(0, 30), alphas=[0.02], ttl="level - avg_tries")
def plot_total_level_calculated_level(dirname, f, popt, alpha=0.01, unzip=True, **kwargs): level, solved, tries = read_csvs(dirname) plot_level_calculated_level(np.array(level), (np.array(solved), np.array(tries)), f, popt, alpha, unzip=unzip, **kwargs)
def get_trend_level_log_solved_log_tries(dirname, needed_ppl=1): level, solved, tries = read_csvs(dirname, needed_ppl) popt, r_squared = get_popt_R2(axbyc_log, (solved, tries), level) calculated_level = np.array(axbyc_log((solved, tries), *popt)) new_calculated_level = calculated_level * 2 - 15 print("popt :", popt, ", R^2 :", r_squared) print("Average difference: " + str(np.mean(abs(np.array(level) - calculated_level)))) #print("Average difference(new): " + str(np.mean(abs(np.array(level) - new_calculated_level)))) #print("Average difference(mean):" + str(np.mean(abs(np.array(level) - np.mean(np.array(level)))))) print("Average square: " + str(np.mean(np.square(np.array(level) - calculated_level)))) #print("Average square(new): " + str(np.mean(np.square(np.array(level) - new_calculated_level)))) #print("Average square(mean): " + str(np.mean(np.square(np.array(level) - np.mean(np.array(level)))))) lnspace = np.arange(1, 30, 29 / 100) plot_xys([level, lnspace], [calculated_level, lnspace], styles=['o', '-'], xlbl="Real level", ylbl="Calculated level", xlim=(0, 31), ylim=(0, 31), alphas=[0.01, 1])
def draw_calculated_level_log_solved_log_tries(dirname, a, b, c): K = 100 xmax = 5 ymax = 1.4 level, solved, tries = read_csvs(dirname) calculated_level = np.zeros([K, K]) for i in range(K): for j in range(K): x = i * xmax / K y = j * ymax / K calculated_level[j][i] = a * x + b * y + c #print(level_avg) plt.imshow(calculated_level, cmap=plt.get_cmap('gist_ncar'), norm=Normalize(vmin=-4, vmax=42, clip=True), origin='lower', extent=[0, xmax, 0, ymax], aspect='auto') plt.title("level per log(avg_tries), log(solved)") plt.xlabel("log10(solved)") plt.ylabel("log10(avg_tries)") plt.colorbar() plt.show()