Skip to content

Commit

Permalink
Update run.py
Browse files Browse the repository at this point in the history
change function names
  • Loading branch information
eyounx authored Jan 18, 2018
1 parent 0da9af0 commit 424442a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions example/direct_policy_search_for_gym/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def run_test(task_name, layers, in_budget, max_step, repeat, terminal_value=None):
"""
Api of running direct policy search for gym task.
example of running direct policy search for gym task.
:param task_name: gym task name
:param layers:
Expand Down Expand Up @@ -43,17 +43,17 @@ def run_test(task_name, layers, in_budget, max_step, repeat, terminal_value=None
solution_list = ExpOpt.min(objective, parameter, repeat=repeat)


def run_ss_test(task_name, layers, in_budget, max_step, repeat, terminal_value):
def run_test_handlingnoise(task_name, layers, in_budget, max_step, repeat, terminal_value):
"""
Api of running direct policy search with ssracos algorithm for gym task.
example of running direct policy search for gym task with noise handling.
:param task_name: gym task name
:param layers:
layer information of the neural network
e.g., [2, 5, 1] means input layer has 2 neurons, hidden layer(only one) has 5 and output layer has 1
:param in_budget: number of calls to the objective function
:param max_step: max step in gym
:param repeat: repeat number in a test
:param repeat: number of repeatitions for noise handling
:param terminal_value: early stop, algorithm should stop when such value is reached
:return: no return value
"""
Expand Down Expand Up @@ -92,9 +92,7 @@ def run_ss_test(task_name, layers, in_budget, max_step, repeat, terminal_value):
lunarlander_layers = [8, 5, 3, 1]

run_test('MountainCar-v0', mountain_car_layers, 2000, 1000, 1)
run_ss_test('MountainCar-v0', mountain_car_layers, 1000, 1000, 5, terminal_value=-500)
# run_ss_test('MountainCar-v0', mountain_car_layers, 1000, 1000, 10)
# run_test('MountainCar-v0', mountain_car_layers, 10000, 10000, 10)
run_test_handlingnoise('MountainCar-v0', mountain_car_layers, 1000, 1000, 5, terminal_value=-500)
# run_test('Acrobot-v1', acrobot_layers, 2000, 500, 10)
# If you want to run the following examples, you may need to install more libs(mujoco, Box2D).
# run_test('HalfCheetah-v1', halfcheetah_layers, 2000, 10000, 10)
Expand Down

0 comments on commit 424442a

Please sign in to comment.