def __init__(self, feature_size, field_size, embedding_size=8, dropout_fm=[1.0, 1.0], deep_layers=[32, 32], dropout_deep=[0.5, 0.5, 0.5], deep_layers_activation=tf.nn.relu, epoch=10, batch_size=256, learning_rate=0.001, optimizer_type='adam', batch_norm=0, batch_norm_decay=0.995, verbose=False, random_seed=2016, use_fm=True, use_deep=True, loss_type='logloss', eval_metric=roc_auc_score, l2_reg=0.0, greater_is_better=True, threshold=0.5):
    assert (use_fm or use_deep)
    assert (loss_type in ['logloss', 'mse']), "loss_type can be either 'logloss' for classification task or 'mse' for regression task"
    self.feature_size = feature_size
    self.field_size = field_size
    self.embedding_size = embedding_size
    self.dropout_fm = dropout_fm
    self.deep_layers = deep_layers
    self.dropout_deep = dropout_deep
    self.deep_layers_activation = deep_layers_activation
    self.use_fm = use_fm
    self.use_deep = use_deep
    self.l2_reg = l2_reg
    self.epoch = epoch
    self.batch_size = batch_size
    self.learning_rate = learning_rate
    self.optimizer_type = optimizer_type
    self.batch_norm = batch_norm
    self.batch_norm_decay = batch_norm_decay
    self.verbose = verbose
    self.random_seed = random_seed
    self.loss_type = loss_type
    self.eval_metric = eval_metric
    self.greater_is_better = greater_is_better
    (self.train_result, self.valid_result) = ([], [])
    self.sess = None
    self.graph = None
    self._config = None
    self.threshold = threshold
def __init__(self, feature_size, field_size, embedding_size=8, dropout_fm=[1.0, 1.0], deep_layers=[32, 32], dropout_deep=[0.5, 0.5, 0.5], deep_layers_activation=tf.nn.relu, epoch=10, batch_size=256, learning_rate=0.001, optimizer_type='adam', batch_norm=0, batch_norm_decay=0.995, verbose=False, random_seed=2016, use_fm=True, use_deep=True, loss_type='logloss', eval_metric=roc_auc_score, l2_reg=0.0, greater_is_better=True, threshold=0.5):
    assert (use_fm or use_deep)
    assert (loss_type in ['logloss', 'mse']), "loss_type can be either 'logloss' for classification task or 'mse' for regression task"
    self.feature_size = feature_size
    self.field_size = field_size
    self.embedding_size = embedding_size
    self.dropout_fm = dropout_fm
    self.deep_layers = deep_layers
    self.dropout_deep = dropout_deep
    self.deep_layers_activation = deep_layers_activation
    self.use_fm = use_fm
    self.use_deep = use_deep
    self.l2_reg = l2_reg
    self.epoch = epoch
    self.batch_size = batch_size
    self.learning_rate = learning_rate
    self.optimizer_type = optimizer_type
    self.batch_norm = batch_norm
    self.batch_norm_decay = batch_norm_decay
    self.verbose = verbose
    self.random_seed = random_seed
    self.loss_type = loss_type
    self.eval_metric = eval_metric
    self.greater_is_better = greater_is_better
    (self.train_result, self.valid_result) = ([], [])
    self.sess = None
    self.graph = None
    self._config = None
    self.threshold = threshold