Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ベストsubのネットワーク構造をinput3層にした場合を試す #17

Closed
4 tasks done
masatakashiwagi opened this issue Oct 11, 2020 · 4 comments
Closed
4 tasks done
Assignees
Labels
experiment experiment

Comments

@masatakashiwagi
Copy link
Contributor

masatakashiwagi commented Oct 11, 2020

ToDo

  • ベストのsubをFORKして、実験を行う
    • 中間層のユニット数は少し調整する
  • 実験
  • 1. epoch=35, seeds=3パターン, activation function=ELU
    • g- / c- / all feats(g-/c-/cp-)、それぞれのMLPに通した出力を別のMLPに渡してoutputとする
  • 2. epoch=50, seeds=2パターン, activation function=ELU
    • g-の出力をc-とconcatしてMLPに通した出力とall featsのMLPに通した出力を別のMLPに渡してoutputとする
  • 3. epoch=50, seeds=2パターン, activation function=ReLU
    • 実験2と同じ

モデル

こちらのsubで実験したモデルをベースにした

モデルの特徴

  • モデル: g- / c- / all feats(g-/c-/cp-)の特徴量をそれぞれ分けて3 inputとしてMLPを行った
@masatakashiwagi masatakashiwagi added the experiment experiment label Oct 11, 2020
@masatakashiwagi masatakashiwagi self-assigned this Oct 11, 2020
@masatakashiwagi
Copy link
Contributor Author

masatakashiwagi commented Oct 12, 2020

実験1

Local Score

今回: 0.015264159755005106
元々: 0.014564886043488417
差分: 0.0006992737115

LB Score

今回: 0.01927
元々: 0.01867
差分: 0.0006

Local CVとLBの相関はありそう。

モデル構造

hidden_size_list = [
        [872,512,512,256,128], # genes
        [130,128,128,64,32], # cells
        [1007,512,512,256,128], # all
        [288,256,256] # last
]

class MultiInputTabularNN(nn.Module):
    def __init__(self, cfg):
        super(MultiInputTabularNN, self).__init__()
        # genes
        genes_layer = []
        hidden_size = cfg.hidden_size_list[0]
        for i in range(len(hidden_size)-1):
            genes_layer.append(nn.BatchNorm1d(hidden_size[i]))
            genes_layer.append(nn.Dropout(cfg.dropout))
            genes_layer.append(nn.utils.weight_norm(nn.Linear(hidden_size[i], hidden_size[i+1])))
            genes_layer.append(nn.ELU())
        self.genes_block = nn.Sequential(*genes_layer)
        
        # cells
        cells_layer = []
        hidden_size = cfg.hidden_size_list[1]
        for i in range(len(hidden_size)-1):
            cells_layer.append(nn.BatchNorm1d(hidden_size[i]))
            cells_layer.append(nn.Dropout(cfg.dropout))
            cells_layer.append(nn.utils.weight_norm(nn.Linear(hidden_size[i], hidden_size[i+1])))
            cells_layer.append(nn.ELU())
        self.cells_block = nn.Sequential(*cells_layer)
        
        # all = genes + cells + meta
        all_layer = []
        hidden_size = cfg.hidden_size_list[2]
        for i in range(len(hidden_size)-1):
            all_layer.append(nn.BatchNorm1d(hidden_size[i]))
            all_layer.append(nn.Dropout(cfg.dropout))
            all_layer.append(nn.utils.weight_norm(nn.Linear(hidden_size[i], hidden_size[i+1])))
            all_layer.append(nn.ELU())
        self.all_block = nn.Sequential(*all_layer)

        # full connection
        fc_layer = []
        hidden_size = cfg.hidden_size_list[3]
        for i in range(len(hidden_size)-1):
            fc_layer.append(nn.BatchNorm1d(hidden_size[i]))
            fc_layer.append(nn.Dropout(cfg.dropout))
            fc_layer.append(nn.utils.weight_norm(nn.Linear(hidden_size[i], hidden_size[i+1])))
            fc_layer.append(nn.ELU())
        fc_layer.append(nn.BatchNorm1d(hidden_size[-1]))
        fc_layer.append(nn.Dropout(cfg.dropout))
        fc_layer.append(nn.utils.weight_norm(nn.Linear(hidden_size[-1], len(cfg.target_cols))))
        self.fc_block = nn.Sequential(*fc_layer)

    def forward(self, input_gene, input_cell, input_all):
        # gene
        x1 = self.genes_block(input_gene)
        
        # cell
        x2 = self.cells_block(input_cell)
        
        # all = gene + cell + meta
        x3 = self.all_block(input_all)
        
        # concatenate
        x = torch.cat([x1, x2, x3], dim=1)
        x = self.fc_block(x)
        
        return x

@masatakashiwagi
Copy link
Contributor Author

masatakashiwagi commented Oct 12, 2020

実験2

Local Score

今回: 0.015213956350176748
元々: 0.014564886043488417
差分: 0.0006490703067

LB Score

今回: 0.01924
元々: 0.01867
差分: 0.00057

モデル構造

hidden_size_list = [
        [872,512,512,256,256], # genes
        [256+130,256,256,128,128], # cells
        [1007,512,512,256,256], # all
        [384,256,256] # last
]

class MultiInputTabularNN(nn.Module):
    def __init__(self, cfg):
        super(MultiInputTabularNN, self).__init__()
        ... # 実験1と同じ構造

    def forward(self, input_gene, input_cell, input_all):
        # gene
        x1 = self.genes_block(input_gene)
        
        # cell
        input_cell_x1 = torch.cat([x1, input_cell], dim=1)
        x2 = self.cells_block(input_cell_x1)
        
        # all = gene + cell + meta
        x3 = self.all_block(input_all)
        
        # concatenate
        x = torch.cat([x2, x3], dim=1)
        x = self.fc_block(x)
        
        return x

@masatakashiwagi
Copy link
Contributor Author

masatakashiwagi commented Oct 13, 2020

実験3

  • 活性化関数はELUよりReLUの方が良さそう
    • ReLUの方がlossの上がり方が大きい

@masatakashiwagi
Copy link
Contributor Author

masatakashiwagi commented Oct 13, 2020

実験まとめ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment experiment
Projects
None yet
Development

No branches or pull requests

1 participant