Passed
Push — master ( cc7a4b...4d42d8 )
by Konstantinos
43s queued 14s
created

so_magic.data.dataset.DatapointsFactory.create()   A

Complexity

Conditions 3

Size

Total Lines 13
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 13
nop 4
dl 0
loc 13
rs 9.75
c 0
b 0
f 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