cnn_classifier.py 文件源码

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

项目:sentence_classification 作者: zhegan27 项目源码 文件源码
def init_params(options,W):

    params = OrderedDict()
    # W is initialized by the pretrained word embedding
    params['Wemb'] = W.astype(config.floatX)
    # otherwise, W will be initialized randomly
    # n_words = options['n_words']
    # n_x = options['n_x'] 
    # params['Wemb'] = uniform_weight(n_words,n_x)

    length = len(options['filter_shapes'])
    for idx in range(length):
        params = param_init_encoder(options['filter_shapes'][idx],params,prefix=_p('cnn_encoder',idx))

    n_h = options['feature_maps'] * length
    params['Wy'] = uniform_weight(n_h,options['n_y'])
    params['by'] = zero_bias(options['n_y'])                                     

    return params
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号