-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsom_data_struct.py
More file actions
executable file
·30 lines (23 loc) · 950 Bytes
/
som_data_struct.py
File metadata and controls
executable file
·30 lines (23 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import numpy as np
class som_data_struct:
def __init__(self, D, labels=None, name="", comp_names=None, comp_norm=None, label_names=None):
self.type = "som_data"
self.data = D
self.labels = labels if labels is not None else []
self.name = name
self.comp_names = comp_names if comp_names is not None else []
self.comp_norm = comp_norm if comp_norm is not None else []
self.label_names = label_names if label_names is not None else []
dlen = D.shape[0]
dim = D.shape[1]
# defaults
if name == "":
self.name = "unnamed"
if self.labels == []:
self.labels = [''] * dlen
if self.comp_names == []:
self.comp_names = [''] * dim
for i in range(0, dim):
self.comp_names[i] = 'variable ' + str(i)
if self.comp_norm == []:
self.comp_norm = [[] for i in range(dim)]