base_model.lua 1.58 KB
Newer Older
dengjb's avatar
update  
dengjb committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--------------------------------------------------------------------------------
-- Base Class for Providing Models
--------------------------------------------------------------------------------

local class = require 'class'

BaseModel = class('BaseModel')

function BaseModel:__init(conf)
   conf = conf or {}
end

-- Returns the name of the model
function BaseModel:model_name()
   return 'DoesNothingModel'
end

-- Defines models and networks
function BaseModel:Initialize(opt)
  models = {}
  return models
end

-- Runs the forward pass of the network
function BaseModel:Forward(input, opt)
  output = {}
  return output
end

-- Runs the backprop gradient descent
-- Corresponds to a single batch of data
function BaseModel:OptimizeParameters(opt)
end

-- This function can be used to reset momentum after each epoch
function BaseModel:RefreshParameters(opt)
end

-- This function can be used to reset momentum after each epoch
function BaseModel:UpdateLearningRate(opt)
end
-- Save the current model to the file system
function BaseModel:Save(prefix, opt)
end

-- returns a string that describes the current errors
function BaseModel:GetCurrentErrorDescription()
  return "No Error exists in BaseModel"
end

-- returns current errors
function BaseModel:GetCurrentErrors(opt)
  return {}
end

-- returns a table of image/label pairs that describe
-- the current results.
-- |return|: a table of table. List of image/label pairs
function BaseModel:GetCurrentVisuals(opt, size)
  return {}
end

-- returns a string that describes the display plot configuration 
function BaseModel:DisplayPlot(opt)
  return {}
end