optimize.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Hyperopt-Keras-CNN-CIFAR-100 作者: guillaume-chevalier 项目源码 文件源码
def plot_base_and_best_models():
    """Plot a demo model."""
    space_base_demo_to_plot = {
        'lr_rate_mult': 1.0,
        'l2_weight_reg_mult': 1.0,
        'batch_size': 300,
        'optimizer': 'Nadam',
        'coarse_labels_weight': 0.2,
        'conv_dropout_drop_proba': 0.175,
        'fc_dropout_drop_proba': 0.3,
        'use_BN': True,

        'first_conv': 4,
        'residual': 4,
        'conv_hiddn_units_mult': 1.0,
        'nb_conv_pool_layers': 3,
        'conv_pool_res_start_idx': 0.0,
        'pooling_type': 'inception',
        'conv_kernel_size': 3.0,
        'res_conv_kernel_size': 3.0,

        'fc_units_1_mult': 1.0,
        'one_more_fc': 1.0,
        'activation': 'elu'
    }
    space_best_model = {
        "activation": "elu",
        "batch_size": 320.0,
        "coarse_labels_weight": 0.3067103474295116,
        "conv_dropout_drop_proba": 0.25923531175521264,
        "conv_hiddn_units_mult": 1.5958302613876916,
        "conv_kernel_size": 3.0,
        "conv_pool_res_start_idx": 0.0,
        "fc_dropout_drop_proba": 0.4322253354921089,
        "fc_units_1_mult": 1.3083964454436132,
        "first_conv": 3,
        "l2_weight_reg_mult": 0.41206755600055983,
        "lr_rate_mult": 0.6549347353077412,
        "nb_conv_pool_layers": 3,
        "one_more_fc": None,
        "optimizer": "Nadam",
        "pooling_type": "avg",
        "res_conv_kernel_size": 2.0,
        "residual": 3.0,
        "use_BN": True
    }

    model = build_model(space_base_demo_to_plot)
    plot_model(model, to_file='model_demo.png', show_shapes=True)
    print("Saved base model visualization to model_demo.png.")
    K.clear_session()
    del model

    model = build_model(space_best_model)
    plot_model(model, to_file='model_best.png', show_shapes=True)
    print("Saved best model visualization to model_best.png.")
    K.clear_session()
    del model
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号