Пример #1
0
 def get_cfg(key=None):
     if key is None:
         cfg = CfgNode()
         cfg.feature_units = -1  # -1 means not given and we will use the units of BERT
         # TODO(sxjscience) Use a class to store the TextNet
         cfg.text_net = CfgNode()
         cfg.text_net.use_segment_id = True
         cfg.text_net.pool_type = 'cls'
         cfg.agg_net = FeatureAggregator.get_cfg()
         cfg.categorical_net = CategoricalFeatureNet.get_cfg()
         cfg.numerical_net = NumericalFeatureNet.get_cfg()
         cfg.initializer = CfgNode()
         cfg.initializer.weight = ['truncnorm', 0, 0.02]
         cfg.initializer.bias = ['zeros']
         return cfg
     else:
         raise NotImplementedError
 def get_cfg(key=None):
     if key is None:
         cfg = CfgNode()
         cfg.base_feature_units = -1  # -1 means not given and we will use the units of BERT
         cfg.text_net = CfgNode()
         cfg.text_net.use_segment_id = True
         cfg.text_net.pool_type = 'cls'
         cfg.aggregate_categorical = True  # Whether to use one network to aggregate the categorical columns.
         cfg.categorical_agg = CfgNode()
         cfg.categorical_agg.activation = 'leaky'
         cfg.categorical_agg.mid_units = 128
         cfg.categorical_agg.num_layers = 1
         cfg.categorical_agg.dropout = 0.1
         cfg.categorical_agg.gated_activation = False
         cfg.agg_net = FeatureAggregator.get_cfg()
         cfg.categorical_net = CategoricalFeatureNet.get_cfg()
         cfg.numerical_net = NumericalFeatureNet.get_cfg()
         cfg.initializer = CfgNode()
         cfg.initializer.weight = ['xavier', 'uniform', 'avg', 3.0]
         cfg.initializer.bias = ['zeros']
         return cfg
     else:
         raise NotImplementedError