so_magic.data.dataset   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A Dataset.features() 0 3 1
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