| Total Complexity | 2 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import attr |
||
| 2 | |||
| 3 | |||
| 4 | @attr.s(str=True, repr=True) |
||
| 5 | class Dataset: |
||
| 6 | """High level representation of data, of some form. |
||
| 7 | |||
| 8 | Instances of this class encapsulate observations in the form of datapoints |
||
| 9 | as well as their respective feature vectors. Feature vectors can then be |
||
| 10 | trivially "fed" into a Machine Learning algorithm (eg SOM). |
||
| 11 | |||
| 12 | Args: |
||
| 13 | datapoints (): |
||
| 14 | name (str, optional): |
||
| 15 | Returns: |
||
| 16 | [type]: [description] |
||
| 17 | """ |
||
| 18 | datapoints = attr.ib(init=True) |
||
| 19 | name = attr.ib(init=True, default=None) |
||
| 20 | |||
| 21 | _features = attr.ib(init=True, default=[]) |
||
| 22 | size = attr.ib(init=False, default=attr.Factory(lambda self: len(self.datapoints) if self.datapoints else 0, |
||
| 23 | takes_self=True)) |
||
| 24 | |||
| 25 | @property |
||
| 26 | def features(self): |
||
| 27 | return self._features |
||
| 28 | |||
| 29 | @features.setter |
||
| 30 | def features(self, features): |
||
| 31 | self._features = features |
||
| 32 |