-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
39 lines (32 loc) · 1.03 KB
/
model.py
File metadata and controls
39 lines (32 loc) · 1.03 KB
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
import abc
class Model(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def get_params_mapping(self):
"""This method should return a dictionary mapping parameter in cache
to its gradient in d_cache and shape of the parameter matrix."""
return
class SupervisedModel(Model):
@abc.abstractmethod
def get_batch_generator(self, batch_size, data, labels):
"""Returns a dictionary of parameters for batch generator class specific
to given model.
"""
return
@abc.abstractmethod
def train(self, data, labels):
"""This method should perform forward and backward propogation for given
data and return cache, d_cache and loss."""
return
class UnsupervisedModel(Model):
@abc.abstractmethod
def get_batch_generator(self, batch_size, data):
"""Returns a dictionary of parameters for batch generator class specific
to given model.
"""
return
@abc.abstractmethod
def train(self, data):
"""This method should perform forward and backward propogation for given
data and return cache, d_cache and loss."""
return