Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
plt.xlabel('Training iterations')
plt.ylabel('Error')
plt.yscale('log')
# load in the weights and see how well they control the arm
dt = 1e-2
sig_len = 40
# HACK: append system path to have access to the arm code
# NOTE: Change this path to wherever your plant model is kept!
sys.path.append("../../../studywolf_control/studywolf_control/")
# from arms.two_link.arm_python import Arm as Arm
from arms.three_link.arm import Arm as Arm
if verbose:
print('Plant is: %s' % str(Arm))
arm = Arm(dt=dt)
from hessianfree import RNNet
from hessianfree.nonlinearities import (Tanh, Linear)
from train_hf_3link import PlantArm, gen_targets
rec_coeff = [1, 1]
rec_type = "sparse"
eps = 1e-6
num_states = arm.DOF * 2
targets = gen_targets(arm, sig_len=sig_len)
init_state = np.zeros((len(targets), num_states), dtype=np.float32)
init_state[:, :arm.DOF] = arm.init_q # set up the initial joint angles
plant = PlantArm(arm, targets=targets,
init_state=init_state, eps=eps)
plt.title('AHF training error')
plt.xlabel('Training iterations')
plt.ylabel('Error')
plt.yscale('log')
# load in the weights and see how well they control the arm
dt = 1e-2
sig_len = 40
# HACK: append system path to have access to the arm code
# NOTE: Change this path to wherever your plant model is kept!
sys.path.append("../../../studywolf_control/studywolf_control/")
# from arms.two_link.arm_python import Arm as Arm
from arms.three_link.arm import Arm as Arm
if verbose:
print('Plant is: %s' % str(Arm))
arm = Arm(dt=dt)
from hessianfree import RNNet
from hessianfree.nonlinearities import (Tanh, Linear)
from train_hf_3link import PlantArm, gen_targets
rec_coeff = [1, 1]
rec_type = "sparse"
eps = 1e-6
num_states = arm.DOF * 2
targets = gen_targets(arm, sig_len=sig_len)
init_state = np.zeros((len(targets), num_states), dtype=np.float32)
init_state[:, :arm.DOF] = arm.init_q # set up the initial joint angles
plant = PlantArm(arm, targets=targets,
init_state=init_state, eps=eps)