Passed
Push — datapoints-package ( a11eff )
by Konstantinos
02:48
created

so_magic.data.dataset.DatapointsManager.update()   A

Complexity

Conditions 3

Size

Total Lines 9
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 9
nop 2
dl 0
loc 9
rs 9.95
c 0
b 0
f 0
1
from abc import ABC, abstractmethod
2
import os
3
import attr
4
5
from so_magic.utils import Observer
6
7
8
@attr.s(str=True, repr=True)
9
class Dataset:
10
    """High level representation of data, of some form.
11
12
    Instances of this class encapsulate observations in the form of datapoints
13
    as well as their respective feature vectors. Feature vectors can then be 
14
    trivially "fed" into a Machine Learning algorithm (eg SOM).
15
16
    Args:
17
        datapoints ():
18
        name (str, optional): 
19
        name (str, optional):
20
    Returns:
21
        [type]: [description]
22
    """
23
    datapoints = attr.ib(init=True)
24
    name = attr.ib(init=True, default=None)
25
26
    _features = attr.ib(init=True, default=[])
27
    size = attr.ib(init=False, default=attr.Factory(lambda self: len(self.datapoints) if self.datapoints else 0, takes_self=True))
28
29
    @property
30
    def features(self):
31
        return self._features
32
33
    @features.setter
34
    def features(self, features):
35
        self._features = features
36