泛型模型实例
来源:互联网 发布:淘宝中差评回复语 编辑:程序博客网 时间:2024/06/06 18:39
需要一定的keras基础,然后还请对着代码和图认真的看一看实现过程,其实不算复杂
文章来源与keras中文翻译网站,想查看具体内容还请移步到这里该教程里面有更为详细的解释,我只是搬运并记录了一下。
- 泛型模型实例:
- code:
from keras.layers import Input, Embedding, LSTM, Dense, mergefrom keras.models import Model# headline input: meant to receive sequences of 100 integers, between 1 and 10000.# note that we can name any layer by passing it a "name" argument.main_input = Input(shape=(100,), dtype='int32', name='main_input')# this embedding layer will encode the input sequence# into a sequence of dense 512-dimensional vectors.x = Embedding(output_dim=512, input_dim=10000, input_length=100)(main_input)# a LSTM will transform the vector sequence into a single vector,# containing information about the entire sequencelstm_out = LSTM(32)(x)auxiliary_output = Dense(1, activation='sigmoid', name='aux_output')(lstm_out)auxiliary_input = Input(shape=(5,), name='aux_input')x = merge([lstm_out, auxiliary_input], mode='concat')# we stack a deep fully-connected network on topx = Dense(64, activation='relu')(x)x = Dense(64, activation='relu')(x)x = Dense(64, activation='relu')(x)# and finally we add the main logistic regression layermain_output = Dense(1, activation='sigmoid', name='main_output')(x)model = Model(input=[main_input, auxiliary_input], output=[main_output, auxiliary_output])model.compile(optimizer='rmsprop', loss='binary_crossentropy', loss_weights=[1., 0.2])model.fit([headline_data, additional_data], [labels, labels], nb_epoch=50, batch_size=32)
0 0
- 泛型模型实例
- 完成端口模型实例
- iphone模型数据 实例
- epoll模型实例
- WCF实例模型
- 模型实例化 thinkphp
- C++ 网络模型实例
- WSAAsyncSelect模型 实例
- epoll模型实例
- 单实例模型 分析
- select 模型实例
- WinSock IO模型 实例
- LVS-NAT模型实例
- 实例模型-学习笔记
- css盒子模型实例
- 盒子模型主页实例
- ThinkPHP 实例化模型
- 模型实例化
- linux可执行程序如何在系统后台运行
- van Emde Boas树
- Kubernetes Eviction Manager源码分析
- 基类与派生类的内部存储细节
- Alpha测试与Beta测试概念
- 泛型模型实例
- 通量与散度
- C#静态构造函数调用机制
- Zookeeper与Paxos
- 火影忍者启航篇
- angularJS+requireJS实现controller及directive的按需加载
- CreateFile, ReadFile详解
- 集合框架
- mysql开远程访问权限