Example #1
0
def get_model(cfg):

    num_classes = int(cfg['n_classes'])
    input_size = int(cfg['data_dim'])

    if cfg['model'] == 'blstm':
        classifier = BiLSTM(input_size,
                            n_classes=num_classes,
                            embedding_size=128,
                            hidden_size=256,
                            dropout=cfg['dropout'])
    if cfg['model'] == 'dec_ori':
        classifier = DGCNNSeq(input_size,
                              int(cfg['embedding_size']),
                              num_classes,
                              batch_size=int(cfg['batch_size']),
                              k=5,
                              fov=1,
                              dropout=0.5)
    if cfg['model'] == 'dec':
        classifier = DECSeq(
            input_size,
            int(cfg['embedding_size']),
            num_classes,
            dropout=cfg['dropout'],
            #fov=3,
            k=int(cfg['k_dec']),
            # k=5,
            aggr='max',
            #pool_op=global_max_pool)
            pool_op=cfg['pool_op'])
        #bn=True)
    if cfg['model'] == 'nnc':
        classifier = NNC(input_size,
                         int(cfg['embedding_size']),
                         num_classes,
                         batch_size=int(cfg['batch_size']),
                         pool_op=cfg['pool_op'],
                         same_size=cfg['same_size'])
    if cfg['model'] == 'gcn':
        classifier = GCNConvNetBN(input_size,
                                int(cfg['embedding_size']),
                                num_classes,
                                pool_op=cfg['pool_op'],
                                same_size=cfg['same_size'])
    if cfg['model'] == 'gat':
        classifier = GAT(input_size,
                                num_classes)

    elif cfg['model'] == 'pn_geom':
        classifier = PNptg2(input_size,
                           int(cfg['embedding_size']),
                           num_classes,
                           #batch_size=int(cfg['batch_size']),
                           same_size=cfg['same_size'])
    return classifier
Example #2
0
def get_model(cfg):

    num_classes = int(cfg['n_classes'])
    input_size = int(cfg['data_dim'])
    n_gf = int(cfg['num_gf'])

    if cfg['model'] == 'blstm':
        classifier = BiLSTM(input_size,
                            n_classes=num_classes,
                            embedding_size=128,
                            hidden_size=256)
    if cfg['model'] == 'dec_ori':
        classifier = DGCNNSeq(input_size,
                              int(cfg['embedding_size']),
                              num_classes,
                              batch_size=int(cfg['batch_size']),
                              k=3,
                              fov=1,
                              dropout=0.5)
    if cfg['model'] == 'dec':
        classifier = DECSeq(
            input_size,
            int(cfg['embedding_size']),
            num_classes,
            #fov=3,
            batch_size=int(cfg['batch_size']),
            k=7,
            aggr='max',
            pool_op=global_max_pool,
            same_size=cfg['same_size'])
        #bn=True)
    if cfg['model'] == 'nnc':
        classifier = NNC(input_size,
                         int(cfg['embedding_size']),
                         num_classes,
                         batch_size=int(cfg['batch_size']),
                         pool_op=global_max_pool,
                         same_size=cfg['same_size'])
    if cfg['model'] == 'gcn':
        classifier = GCNConvNet(input_size,
                                int(cfg['embedding_size']),
                                num_classes,
                                batch_size=int(cfg['batch_size']),
                                pool_op=global_max_pool,
                                same_size=cfg['same_size'])
    elif cfg['model'] == 'pn_geom':
        classifier = PNptg(input_size,
                           int(cfg['embedding_size']),
                           num_classes,
                           batch_size=int(cfg['batch_size']),
                           pool_op=global_max_pool,
                           same_size=cfg['same_size'])
    return classifier