| Total Complexity | 5 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/env python |
||
| 7 | class Dataset(object): |
||
| 8 | """ |
||
| 9 | Abstract dataset class. |
||
| 10 | """ |
||
| 11 | __metaclass__ = ABCMeta |
||
| 12 | |||
| 13 | @abstractmethod |
||
| 14 | def train_set(self): |
||
| 15 | """ |
||
| 16 | :rtype: list of tuple |
||
| 17 | """ |
||
| 18 | |||
| 19 | def valid_set(self): |
||
| 20 | """ |
||
| 21 | :rtype: list of tuple |
||
| 22 | """ |
||
| 23 | |||
| 24 | def test_set(self): |
||
| 25 | """ |
||
| 26 | :rtype: list of tuple |
||
| 27 | """ |
||
| 28 | |||
| 29 | def train_size(self): |
||
| 30 | """ |
||
| 31 | Return size of training data. (optional) |
||
| 32 | :rtype: number |
||
| 33 | """ |
||
| 34 | train_set = self.train_set() |
||
| 35 | if isinstance(train_set, collections.Iterable): |
||
| 36 | return len(list(train_set)) |
||
| 37 | else: |
||
| 38 | return None |