File size: 2,223 Bytes
dc7407d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from typing import NamedTuple, List, Callable, List, Tuple, Optional
import torch

class LinData(NamedTuple):
    in_dim : int # input dimension
    hidden_layers : List[int] # hidden layers including the output layer
    activations : List[Optional[Callable[[torch.Tensor],torch.Tensor]]] # list of activations
    bns : List[bool] # list of bools
    dropouts : List[Optional[float]] # list of dropouts probas
        
class CNNData(NamedTuple):
    in_dim : int # input dimension
    n_f : List[int] # num filters
    kernel_size : List[Tuple] # kernel size [(5,5,5), (3,3,3),(3,3,3)]
    activations : List[Optional[Callable[[torch.Tensor],torch.Tensor]]] # activation list
    bns : List[bool] # batch normialization [True, True, False]
    dropouts : List[Optional[float]] # # list of dropouts probas [.5,0,0]
    #dropouts_ps : list # [0.5,.7, 0]
    paddings : List[Optional[Tuple]] #[(0,0,0),(0,0,0), (0,0,0)]
    strides : List[Optional[Tuple]] #[(1,1,1),(1,1,1),(1,1,1)]
    
    
class NetData(NamedTuple):
    cnn3d : CNNData
    lin : LinData


'''   
class LinData(NamedTuple):
    in_dim : int
    #num_classes : int
    hidden_layers : list
    activations : list
    bns : list
    dropouts : list
     
class CNNData(NamedTuple):
    in_dim : int # input dimension
    n_f : list # num filters
    kernel_size : list # kernel size [(5,5,5), (3,3,3),(3,3,3)]
    activations : list # activation list
    bns : list # batch normialization [True, True, False]
    dropouts : list # [True, True, False]
    #dropouts_ps : list # [0.5,.7, 0]
    paddings : list #[(0,0,0),(0,0,0), (0,0,0)]
    strides : list #[(1,1,1),(1,1,1),(1,1,1)]
        
class NetData(NamedTuple):
    cnn3d : CNNData
    lin : LinData
    
    
class Mdata(NamedTuple):
    cm : list
    ba : float
    sn : float
    sp : float
    tn : int
    fp : int
    fn : int
    tp : int
 
class MetricData(NamedTuple):
    train : Mdata
    test : Mdata
    
'''
    
    
# for outputs
class history():
    def __init__(self, train, val, test):
        self.train = train
        self.test = test
        self.val = val
        
class metrics():
    def __init__(self, r2, loss):
        self.r2 = r2
        self.loss = loss