Changing linear regression back to log based
@ -43,7 +43,7 @@ def replicate_base_loss(theta_array, desired_theta, base_key):
|
||||
# ---------------------------------------------------------------------
|
||||
# Helper: safe regression function (handles log transforms, filters invalid data)
|
||||
# ---------------------------------------------------------------------
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=False):
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=True):
|
||||
"""
|
||||
Computes a best-fit line using linear regression, optionally on log(x) and/or log(y).
|
||||
Returns:
|
||||
@ -215,7 +215,7 @@ def process_condition(condition_name):
|
||||
ax_top.set_ylabel(f"Final Loss @ epoch {final_epoch}")
|
||||
ax_top.set_title(f"{condition_name}: Final Loss vs. Exponent")
|
||||
# best-fit line
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["final_loss"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["final_loss"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
ax_top.plot(xs, y_fit, "k--", label=f"slope={slope:.3f}, int={intercept:.3f}, R²={R2:.3f}")
|
||||
ax_top.legend(fontsize=8)
|
||||
@ -236,7 +236,7 @@ def process_condition(condition_name):
|
||||
ax_bot.set_ylabel("Epochs to Convergence")
|
||||
ax_bot.set_title(f"{condition_name}: Convergence vs. Exponent")
|
||||
# best-fit line
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["epochs_to_convergence"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["epochs_to_convergence"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
ax_bot.plot(xs, y_fit, "k--", label=f"slope={slope:.3f}, int={intercept:.3f}, R²={R2:.3f}")
|
||||
ax_bot.legend(fontsize=8)
|
||||
|
||||
@ -43,7 +43,7 @@ def replicate_base_loss(theta_array, desired_theta, base_key):
|
||||
# ---------------------------------------------------------------------
|
||||
# Helper: safe regression function (handles log transforms, filters invalid data)
|
||||
# ---------------------------------------------------------------------
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=False):
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=True):
|
||||
"""
|
||||
Computes a best-fit line using linear regression, optionally on log(x) and/or log(y).
|
||||
Returns:
|
||||
@ -215,7 +215,7 @@ def process_condition(condition_name):
|
||||
ax_top.set_ylabel(f"Final Loss @ epoch {final_epoch}")
|
||||
ax_top.set_title(f"{condition_name}: Final Loss vs. Exponent")
|
||||
# best-fit line
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["final_loss"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["final_loss"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
ax_top.plot(xs, y_fit, "k--", label=f"slope={slope:.3f}, int={intercept:.3f}, R²={R2:.3f}")
|
||||
ax_top.legend(fontsize=8)
|
||||
@ -236,7 +236,7 @@ def process_condition(condition_name):
|
||||
ax_bot.set_ylabel("Epochs to Convergence")
|
||||
ax_bot.set_title(f"{condition_name}: Convergence vs. Exponent")
|
||||
# best-fit line
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["epochs_to_convergence"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["Exponent"], df["epochs_to_convergence"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
ax_bot.plot(xs, y_fit, "k--", label=f"slope={slope:.3f}, int={intercept:.3f}, R²={R2:.3f}")
|
||||
ax_bot.legend(fontsize=8)
|
||||
|
||||
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 267 KiB After Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 269 KiB After Width: | Height: | Size: 274 KiB |
|
Before Width: | Height: | Size: 273 KiB After Width: | Height: | Size: 281 KiB |
@ -127,7 +127,7 @@ def find_convergence_epoch(data_dict, desired_theta, threshold):
|
||||
# ---------------------------------------------------------------------
|
||||
# Helper: Compute best-fit line (with R^2) for scatter plot data.
|
||||
# ---------------------------------------------------------------------
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=False):
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=True):
|
||||
"""
|
||||
Computes the best-fit line using linear regression.
|
||||
Filters out NaN and non-positive values if log transforms are used.
|
||||
@ -256,7 +256,7 @@ for cond_name in all_subdirs:
|
||||
axes[0].set_ylabel(f"Loss at Epoch {final_epoch}")
|
||||
axes[0].set_yscale("log")
|
||||
axes[0].set_title(f"{cond_name}: Loss vs. $t_{{median}}$")
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["final_loss"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["final_loss"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
axes[0].plot(xs, y_fit, "k--", label=f"Fit: slope={slope:.3f}, int={intercept:.3f}\n$R^2$={R2:.3f}")
|
||||
axes[0].legend(fontsize=8)
|
||||
@ -273,7 +273,7 @@ for cond_name in all_subdirs:
|
||||
axes[1].set_ylabel("Epochs to Convergence")
|
||||
axes[1].set_yscale("log")
|
||||
axes[1].set_title(f"{cond_name}: Convergence vs. $t_{{median}}$")
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["epochs_to_convergence"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["epochs_to_convergence"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
axes[1].plot(xs, y_fit, "k--", label=f"Fit: slope={slope:.3f}, int={intercept:.3f}\n$R^2$={R2:.3f}")
|
||||
axes[1].legend(fontsize=8)
|
||||
|
||||
|
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 365 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 375 KiB |
|
Before Width: | Height: | Size: 392 KiB After Width: | Height: | Size: 390 KiB |
|
Before Width: | Height: | Size: 390 KiB After Width: | Height: | Size: 392 KiB |
@ -127,7 +127,7 @@ def find_convergence_epoch(data_dict, desired_theta, threshold):
|
||||
# ---------------------------------------------------------------------
|
||||
# Helper: Compute best-fit line (with R^2) for scatter plot data.
|
||||
# ---------------------------------------------------------------------
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=False):
|
||||
def safe_compute_best_fit(x, y, log_x=False, log_y=True):
|
||||
"""
|
||||
Computes the best-fit line using linear regression.
|
||||
Filters out NaN and non-positive values if log transforms are used.
|
||||
@ -256,7 +256,7 @@ for cond_name in all_subdirs:
|
||||
axes[0].set_ylabel(f"Loss at Epoch {final_epoch}")
|
||||
axes[0].set_yscale("log")
|
||||
axes[0].set_title(f"{cond_name}: Loss vs. $t_{{median}}$")
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["final_loss"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["final_loss"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
axes[0].plot(xs, y_fit, "k--", label=f"Fit: slope={slope:.3f}, int={intercept:.3f}\n$R^2$={R2:.3f}")
|
||||
axes[0].legend(fontsize=8)
|
||||
@ -273,7 +273,7 @@ for cond_name in all_subdirs:
|
||||
axes[1].set_ylabel("Epochs to Convergence")
|
||||
axes[1].set_yscale("log")
|
||||
axes[1].set_title(f"{cond_name}: Convergence vs. $t_{{median}}$")
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["epochs_to_convergence"], log_x=False, log_y=False)
|
||||
xs, y_fit, slope, intercept, R2 = safe_compute_best_fit(df["t_median"], df["epochs_to_convergence"], log_x=False, log_y=True)
|
||||
if xs is not None:
|
||||
axes[1].plot(xs, y_fit, "k--", label=f"Fit: slope={slope:.3f}, int={intercept:.3f}\n$R^2$={R2:.3f}")
|
||||
axes[1].legend(fontsize=8)
|
||||
|
||||
|
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 383 KiB |
|
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 341 KiB |
|
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 338 KiB |
|
Before Width: | Height: | Size: 376 KiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 384 KiB After Width: | Height: | Size: 357 KiB |
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 267 KiB After Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 269 KiB After Width: | Height: | Size: 274 KiB |
|
Before Width: | Height: | Size: 273 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 365 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 375 KiB |
|
Before Width: | Height: | Size: 392 KiB After Width: | Height: | Size: 390 KiB |
|
Before Width: | Height: | Size: 390 KiB After Width: | Height: | Size: 392 KiB |
|
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 383 KiB |
|
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 341 KiB |
|
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 338 KiB |
|
Before Width: | Height: | Size: 376 KiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 384 KiB After Width: | Height: | Size: 357 KiB |