remove some old comments
This commit is contained in:
parent
a836314b8b
commit
0fb3b1780f
1 changed files with 3 additions and 19 deletions
22
main.lua
22
main.lua
|
@ -2,8 +2,6 @@ local globalize = require("strict")
|
||||||
|
|
||||||
-- configuration.
|
-- configuration.
|
||||||
|
|
||||||
--randomseed(11)
|
|
||||||
|
|
||||||
local cfg = require("config")
|
local cfg = require("config")
|
||||||
local gcfg = require("gameconfig")
|
local gcfg = require("gameconfig")
|
||||||
|
|
||||||
|
@ -93,6 +91,9 @@ local lerp = util.lerp
|
||||||
local softchoice = util.softchoice
|
local softchoice = util.softchoice
|
||||||
local unperturbed_rank = util.unperturbed_rank
|
local unperturbed_rank = util.unperturbed_rank
|
||||||
|
|
||||||
|
local game = require("smb")
|
||||||
|
game.overlay = cfg.enable_overlay
|
||||||
|
|
||||||
-- utilities.
|
-- utilities.
|
||||||
|
|
||||||
local log_map = {
|
local log_map = {
|
||||||
|
@ -158,12 +159,6 @@ local function make_network(input_size)
|
||||||
return nn.Model({nn_x, nn_tx}, {nn_z})
|
return nn.Model({nn_x, nn_tx}, {nn_z})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- and here we go with the game stuff.
|
|
||||||
-- which was all refactored out, so this comment looks a little silly now.
|
|
||||||
|
|
||||||
local game = require("smb")
|
|
||||||
game.overlay = cfg.enable_overlay
|
|
||||||
|
|
||||||
-- learning and evaluation.
|
-- learning and evaluation.
|
||||||
|
|
||||||
local function prepare_epoch()
|
local function prepare_epoch()
|
||||||
|
@ -174,12 +169,6 @@ local function prepare_epoch()
|
||||||
empty(trial_noise)
|
empty(trial_noise)
|
||||||
empty(trial_rewards)
|
empty(trial_rewards)
|
||||||
|
|
||||||
-- TODO: (optionally) save memory.
|
|
||||||
-- generate noise as needed by saving the seed
|
|
||||||
-- (the os.time() as of here) and calling nn.normal() each trial.
|
|
||||||
-- of course this doubles the amount of time we spend generating noise,
|
|
||||||
-- but that's a fair tradeoff for dividing memory used by noise by `epoch_trials`.
|
|
||||||
|
|
||||||
local precision = (pow(cfg.deviation, 1/-0.51175585) - 8.68297257) / 1.66484392
|
local precision = (pow(cfg.deviation, 1/-0.51175585) - 8.68297257) / 1.66484392
|
||||||
if cfg.graycode then
|
if cfg.graycode then
|
||||||
print(("chosen precision: %.2f"):format(precision))
|
print(("chosen precision: %.2f"):format(precision))
|
||||||
|
@ -187,8 +176,6 @@ local function prepare_epoch()
|
||||||
|
|
||||||
for i = 1, cfg.epoch_trials do
|
for i = 1, cfg.epoch_trials do
|
||||||
local noise = nn.zeros(#base_params)
|
local noise = nn.zeros(#base_params)
|
||||||
-- NOTE: change in implementation: deviation is multiplied here
|
|
||||||
-- and ONLY here now.
|
|
||||||
if cfg.graycode then
|
if cfg.graycode then
|
||||||
--local precision = 1 / cfg.deviation
|
--local precision = 1 / cfg.deviation
|
||||||
--print(cfg.deviation, precision)
|
--print(cfg.deviation, precision)
|
||||||
|
@ -198,8 +185,6 @@ local function prepare_epoch()
|
||||||
for j = 1, #base_params do
|
for j = 1, #base_params do
|
||||||
noise[j] = nn.uniform() < 0.5 and noise[j] or -noise[j]
|
noise[j] = nn.uniform() < 0.5 and noise[j] or -noise[j]
|
||||||
end
|
end
|
||||||
-- TODO? wrap/bound domain to [-1,1].
|
|
||||||
-- dunno if this will work with the learning rate stuff.
|
|
||||||
else
|
else
|
||||||
for j = 1, #base_params do
|
for j = 1, #base_params do
|
||||||
noise[j] = cfg.deviation * nn.normal()
|
noise[j] = cfg.deviation * nn.normal()
|
||||||
|
@ -334,7 +319,6 @@ local function learn_from_epoch()
|
||||||
for i, v in ipairs(top_rewards) do top_rewards[i] = v / reward_dev end
|
for i, v in ipairs(top_rewards) do top_rewards[i] = v / reward_dev end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NOTE: step no longer directly incorporates learning_rate.
|
|
||||||
for i = 1, cfg.epoch_trials do
|
for i = 1, cfg.epoch_trials do
|
||||||
local ind = (i - 1) * 2 + 1
|
local ind = (i - 1) * 2 + 1
|
||||||
local pos = top_rewards[ind + 0]
|
local pos = top_rewards[ind + 0]
|
||||||
|
|
Loading…
Reference in a new issue