|
from typing import NamedTuple, List, Callable, List, Tuple, Optional |
|
import torch |
|
|
|
class LinData(NamedTuple): |
|
in_dim : int |
|
hidden_layers : List[int] |
|
activations : List[Optional[Callable[[torch.Tensor],torch.Tensor]]] |
|
bns : List[bool] |
|
dropouts : List[Optional[float]] |
|
|
|
class CNNData(NamedTuple): |
|
in_dim : int |
|
n_f : List[int] |
|
kernel_size : List[Tuple] |
|
activations : List[Optional[Callable[[torch.Tensor],torch.Tensor]]] |
|
bns : List[bool] |
|
dropouts : List[Optional[float]] |
|
|
|
paddings : List[Optional[Tuple]] |
|
strides : List[Optional[Tuple]] |
|
|
|
|
|
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 |
|
|
|
''' |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|