Fixed a huge issue where base loss centroid convergence was not using 'one' as its reference loss function, resulting in opposite trends.
@ -178,9 +178,9 @@ def process_condition(condition_name):
|
||||
continue
|
||||
final_idx = data_dict["epochs"].index(final_epoch)
|
||||
final_theta = data_dict["theta_over_epochs"][final_idx]
|
||||
final_loss_val = replicate_base_loss(final_theta, desired_theta, base_key)
|
||||
final_loss_val = replicate_base_loss(final_theta, desired_theta, "one")
|
||||
|
||||
conv_epoch = find_convergence_epoch(base_key, data_dict, desired_theta, threshold)
|
||||
conv_epoch = find_convergence_epoch("one", data_dict, desired_theta, threshold)
|
||||
exponent_val = base_loss_functions[base_key][0] # e.g. 1/5, 3, 4, etc.
|
||||
|
||||
results.append({
|
||||
|
||||
|
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 284 KiB After Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 282 KiB After Width: | Height: | Size: 249 KiB |
@ -178,9 +178,9 @@ def process_condition(condition_name):
|
||||
continue
|
||||
final_idx = data_dict["epochs"].index(final_epoch)
|
||||
final_theta = data_dict["theta_over_epochs"][final_idx]
|
||||
final_loss_val = replicate_base_loss(final_theta, desired_theta, base_key)
|
||||
final_loss_val = replicate_base_loss(final_theta, desired_theta, "one")
|
||||
|
||||
conv_epoch = find_convergence_epoch(base_key, data_dict, desired_theta, threshold)
|
||||
conv_epoch = find_convergence_epoch("one", data_dict, desired_theta, threshold)
|
||||
exponent_val = base_loss_functions[base_key][0] # e.g. 1/5, 3, 4, etc.
|
||||
|
||||
results.append({
|
||||
|
||||
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 265 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 260 KiB |
|
After Width: | Height: | Size: 52 KiB |
@ -0,0 +1,2 @@
|
||||
Run #,theta0,omega0,alpha0,desired_theta,final_theta,loss
|
||||
1,12.566370614359172,0.0,0.0,0.0,-0.006831930121820209,4717.5843021979645
|
||||
|
@ -0,0 +1 @@
|
||||
Run #,theta0,omega0,alpha0,desired_theta,final_theta,loss
|
||||
|
@ -3,19 +3,18 @@ import torch.nn as nn
|
||||
from torchdiffeq import odeint
|
||||
import numpy as np
|
||||
import os
|
||||
import shutil
|
||||
import csv
|
||||
import math
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
import sys
|
||||
sys.path.append("/home/judson/Neural-Networks-in-GNC/inverted_pendulum/analysis")
|
||||
from PendulumController import PendulumController
|
||||
|
||||
# List of controller file names to validate.
|
||||
# Replace these paths with your actual controller file paths.
|
||||
controller_file_names = [
|
||||
"/home/judson/Neural-Networks-in-GNC/inverted_pendulum/training/base_loss_learning_rate_sweep/one_fourth/lr_0.300/controllers/controller_199.pth",
|
||||
"/home/judson/Neural-Networks-in-GNC/inverted_pendulum/training/base_loss_learning_rate_sweep/four/lr_0.200/controllers/controller_200.pth"
|
||||
"/home/judson/Neural-Networks-in-GNC/inverted_pendulum/training/time_weighting/constant/controllers/controller_1000.pth",
|
||||
]
|
||||
|
||||
# Constants for simulation
|
||||
@ -30,51 +29,51 @@ t_eval = np.linspace(0, T, num_steps)
|
||||
# In-sample validation cases: [theta0, omega0, alpha0, desired_theta]
|
||||
in_sample_cases = [
|
||||
(1/6 * np.pi, 0.0, 0.0, 0.0),
|
||||
(-1/6 * np.pi, 0.0, 0.0, 0.0),
|
||||
(2/3 * np.pi, 0.0, 0.0, 0.0),
|
||||
(-2/3 * np.pi, 0.0, 0.0, 0.0),
|
||||
(0.0, 1/3 * np.pi, 0.0, 0.0),
|
||||
(0.0, -1/3 * np.pi, 0.0, 0.0),
|
||||
(0.0, 2 * np.pi, 0.0, 0.0),
|
||||
(0.0, -2 * np.pi, 0.0, 0.0),
|
||||
(0.0, 0.0, 0.0, 2*np.pi),
|
||||
(0.0, 0.0, 0.0, -2*np.pi),
|
||||
(0.0, 0.0, 0.0, 1/2 * np.pi),
|
||||
(0.0, 0.0, 0.0, -1/2 * np.pi),
|
||||
(0.0, 0.0, 0.0, 1/3 * np.pi),
|
||||
(0.0, 0.0, 0.0, -1/3 * np.pi),
|
||||
(1/4 * np.pi, 1 * np.pi, 0.0, 0.0),
|
||||
(-1/4 * np.pi, -1 * np.pi, 0.0, 0.0),
|
||||
(1/2 * np.pi, -1 * np.pi, 0.0, 1/3 * np.pi),
|
||||
(-1/2 * np.pi, 1 * np.pi, 0.0, -1/3 * np.pi),
|
||||
(1/4 * np.pi, 1 * np.pi, 0.0, 2 * np.pi),
|
||||
(-1/4 * np.pi, -1 * np.pi, 0.0, 2 * np.pi),
|
||||
(1/2 * np.pi, -1 * np.pi, 0.0, 4 * np.pi),
|
||||
(-1/2 * np.pi, 1 * np.pi, 0.0, -4 * np.pi),
|
||||
# (-1/6 * np.pi, 0.0, 0.0, 0.0),
|
||||
# (2/3 * np.pi, 0.0, 0.0, 0.0),
|
||||
# (-2/3 * np.pi, 0.0, 0.0, 0.0),
|
||||
# (0.0, 1/3 * np.pi, 0.0, 0.0),
|
||||
# (0.0, -1/3 * np.pi, 0.0, 0.0),
|
||||
# (0.0, 2 * np.pi, 0.0, 0.0),
|
||||
# (0.0, -2 * np.pi, 0.0, 0.0),
|
||||
# (0.0, 0.0, 0.0, 2*np.pi),
|
||||
# (0.0, 0.0, 0.0, -2*np.pi),
|
||||
# (0.0, 0.0, 0.0, 1/2 * np.pi),
|
||||
# (0.0, 0.0, 0.0, -1/2 * np.pi),
|
||||
# (0.0, 0.0, 0.0, 1/3 * np.pi),
|
||||
# (0.0, 0.0, 0.0, -1/3 * np.pi),
|
||||
# (1/4 * np.pi, 1 * np.pi, 0.0, 0.0),
|
||||
# (-1/4 * np.pi, -1 * np.pi, 0.0, 0.0),
|
||||
# (1/2 * np.pi, -1 * np.pi, 0.0, 1/3 * np.pi),
|
||||
# (-1/2 * np.pi, 1 * np.pi, 0.0, -1/3 * np.pi),
|
||||
# (1/4 * np.pi, 1 * np.pi, 0.0, 2 * np.pi),
|
||||
# (-1/4 * np.pi, -1 * np.pi, 0.0, 2 * np.pi),
|
||||
# (1/2 * np.pi, -1 * np.pi, 0.0, 4 * np.pi),
|
||||
# (-1/2 * np.pi, 1 * np.pi, 0.0, -4 * np.pi),
|
||||
]
|
||||
|
||||
# Out-of-sample validation cases (generated previously)
|
||||
out_sample_cases = [
|
||||
(-2.198958, -4.428501, 0.450833, 0.000000),
|
||||
(1.714196, -0.769896, 0.202738, 0.000000),
|
||||
(0.241195, -5.493715, 0.438996, 0.000000),
|
||||
(0.030605, 4.901513, -0.479243, 0.000000),
|
||||
(1.930445, -1.301926, -0.454050, 0.000000),
|
||||
(-0.676063, 4.246865, 0.036303, 0.000000),
|
||||
(0.734920, -5.925202, 0.047097, 0.000000),
|
||||
(-3.074471, -3.535424, 0.315438, 0.000000),
|
||||
(-0.094486, 6.111091, 0.150525, 0.000000),
|
||||
(-1.647671, 5.720526, 0.334181, 0.000000),
|
||||
(-2.611260, 5.087704, 0.045460, -3.610785),
|
||||
(1.654137, 0.982081, -0.192725, 1.003872),
|
||||
(-2.394899, 3.550547, -0.430938, 3.261897),
|
||||
(0.474917, 0.555166, -0.285173, 1.866752),
|
||||
(-0.640369, -4.678490, -0.340663, 3.150098),
|
||||
(1.747517, -3.248204, -0.001520, 1.221787),
|
||||
(2.505283, -2.875006, -0.065617, -3.690269),
|
||||
(1.337244, 2.221707, 0.044979, -2.459730),
|
||||
(1.531012, 2.230981, -0.291206, -1.924535),
|
||||
(-1.065792, 4.320740, 0.075405, -1.550644),
|
||||
# (-2.198958, -4.428501, 0.450833, 0.000000),
|
||||
# (1.714196, -0.769896, 0.202738, 0.000000),
|
||||
# (0.241195, -5.493715, 0.438996, 0.000000),
|
||||
# (0.030605, 4.901513, -0.479243, 0.000000),
|
||||
# (1.930445, -1.301926, -0.454050, 0.000000),
|
||||
# (-0.676063, 4.246865, 0.036303, 0.000000),
|
||||
# (0.734920, -5.925202, 0.047097, 0.000000),
|
||||
# (-3.074471, -3.535424, 0.315438, 0.000000),
|
||||
# (-0.094486, 6.111091, 0.150525, 0.000000),
|
||||
# (-1.647671, 5.720526, 0.334181, 0.000000),
|
||||
# (-2.611260, 5.087704, 0.045460, -3.610785),
|
||||
# (1.654137, 0.982081, -0.192725, 1.003872),
|
||||
# (-2.394899, 3.550547, -0.430938, 3.261897),
|
||||
# (0.474917, 0.555166, -0.285173, 1.866752),
|
||||
# (-0.640369, -4.678490, -0.340663, 3.150098),
|
||||
# (1.747517, -3.248204, -0.001520, 1.221787),
|
||||
# (2.505283, -2.875006, -0.065617, -3.690269),
|
||||
# (1.337244, 2.221707, 0.044979, -2.459730),
|
||||
# (1.531012, 2.230981, -0.291206, -1.924535),
|
||||
# (-1.065792, 4.320740, 0.075405, -1.550644),
|
||||
]
|
||||
|
||||
# Define the ODE integration step using RK4, returning the new state and the computed torque.
|
||||
|
||||
|
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 265 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 260 KiB |
|
After Width: | Height: | Size: 52 KiB |
BIN
report/media/analysis/sample_plot.png
Normal file
|
After Width: | Height: | Size: 52 KiB |