def build_predictor(net_type, fp_length, fp_depth, conv_width, h1_size, L2_reg,
                    nll_func):
    if net_type == 'mean':
        return build_mean_predictor(nll_func)
    elif net_type == 'conv_plus_linear':
        vanilla_net_params = dict(layer_sizes=[fp_length],
                                  normalize=True,
                                  L2_reg=L2_reg,
                                  nll_func=nll_func)
        conv_params = dict(num_hidden_features=[conv_width] * fp_depth,
                           fp_length=fp_length)
        return build_conv_deep_net(conv_params, vanilla_net_params)
    elif net_type == 'morgan_plus_linear':
        vanilla_net_params = dict(layer_sizes=[fp_length],
                                  normalize=True,
                                  L2_reg=L2_reg,
                                  nll_func=nll_func)
        return build_morgan_deep_net(fp_length, fp_depth, vanilla_net_params)
    elif net_type == 'conv_plus_net':
        vanilla_net_params = dict(layer_sizes=[fp_length, h1_size],
                                  normalize=True,
                                  L2_reg=L2_reg,
                                  nll_func=nll_func)
        conv_params = dict(num_hidden_features=[conv_width] * fp_depth,
                           fp_length=fp_length)
        return build_conv_deep_net(conv_params, vanilla_net_params)
    elif net_type == 'morgan_plus_net':
        vanilla_net_params = dict(layer_sizes=[fp_length, h1_size],
                                  normalize=True,
                                  L2_reg=L2_reg,
                                  nll_func=nll_func)
        return build_morgan_deep_net(fp_length, fp_depth, vanilla_net_params)
    else:
        raise Exception("Unknown network type.")
 def run_morgan_experiment():
     loss_fun, pred_fun, net_parser = \
         build_morgan_deep_net(model_params['fp_length'],
                               model_params['fp_depth'], vanilla_net_params)
     num_weights = len(net_parser)
     predict_func, trained_weights, conv_training_curve = \
         train_nn(pred_fun, loss_fun, num_weights, train_inputs, train_targets,
                  train_params, validation_smiles=val_inputs, validation_raw_targets=val_targets)
     return print_performance(predict_func)
Esempio n. 3
0
 def run_morgan_experiment():
     loss_fun, pred_fun, net_parser = \
         build_morgan_deep_net(model_params['fp_length'],
                               model_params['fp_depth'], vanilla_net_params)
     num_weights = len(net_parser)
     predict_func, trained_weights, conv_training_curve = \
         train_nn(pred_fun, loss_fun, num_weights, train_inputs, train_targets,
                  train_params, validation_smiles=val_inputs, validation_raw_targets=val_targets)
     return print_performance(predict_func)
def morg_fp_func():
    loss, _, parser = build_morgan_deep_net(fp_length, 1, vanilla_net_params)
    return lambda weights: loss(weights, smiles, targets), parser
def morg_fp_func():
    loss, _, parser = build_morgan_deep_net(fp_length, 1, vanilla_net_params)
    return lambda weights: loss(weights, smiles, targets), parser