-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_utils.py
43 lines (31 loc) · 1023 Bytes
/
data_utils.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
from torch.utils.data import Dataset
class vcf_Dataset(Dataset):
def __init__(self, ref, alt, tissue, label):
self.ref, self.alt, self.tissue, self.label = ref, alt, tissue, label
def __getitem__(self, index):
ref = self.ref[index]
alt = self.alt[index]
tissue = self.tissue[index]
label = self.label[index].float()
return ref, alt, tissue, label
def __len__(self):
return len(self.label)
class plant_Dataset(Dataset):
def __init__(self, data, labels):
self.data = data
self.labels = labels
def __getitem__(self, index):
X = self.data[index]
Y = self.labels[index]
return X, Y
def __len__(self):
return len(self.labels)
class gb_Dataset(Dataset):
def __init__(self, seq, label):
self.X, self.y = seq, label
def __getitem__(self, index):
X = self.X[index]
y = self.y[index].float()
return X, y
def __len__(self):
return len(self.y)