Add support for MSE loss
This commit is contained in:
parent
6051dad793
commit
0eccbc6555
|
@ -75,7 +75,7 @@ cmd:option("-learning_rate_decay", 3.0e-7, 'learning rate decay (learning_rate *
|
||||||
cmd:option("-resume", "", 'resume model file')
|
cmd:option("-resume", "", 'resume model file')
|
||||||
cmd:option("-name", "user", 'model name for user method')
|
cmd:option("-name", "user", 'model name for user method')
|
||||||
cmd:option("-gpu", 1, 'Device ID')
|
cmd:option("-gpu", 1, 'Device ID')
|
||||||
cmd:option("-loss", "huber", 'loss function (huber|l1)')
|
cmd:option("-loss", "huber", 'loss function (huber|l1|mse)')
|
||||||
|
|
||||||
local function to_bool(settings, name)
|
local function to_bool(settings, name)
|
||||||
if settings[name] == 1 then
|
if settings[name] == 1 then
|
||||||
|
|
|
@ -317,6 +317,8 @@ local function create_criterion(model)
|
||||||
end
|
end
|
||||||
elseif settings.loss == "l1" then
|
elseif settings.loss == "l1" then
|
||||||
return w2nn.L1Criterion():cuda()
|
return w2nn.L1Criterion():cuda()
|
||||||
|
elseif settings.loss == "mse" then
|
||||||
|
return w2nn.ClippedMSECriterion(0, 1.0):cuda()
|
||||||
else
|
else
|
||||||
error("unsupported loss .." .. settings.loss)
|
error("unsupported loss .." .. settings.loss)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue