本港台开奖现场直播 j2开奖直播报码现场
当前位置: 新闻频道 > IT新闻 >

wzatv:【j2开奖】专栏 | 卷积神经网络简介(6)

时间:2017-02-21 22:05来源:报码现场 作者:118KJ 点击:
model.add(Convolution2D(nb_filter=32, nb_row=3, nb_col=3, dim_ordering=th, border_mode=same, bias=False, init=uniform)) model.add(Convolution2D(nb_filter=32, nb_row=3, nb_col=3, dim_ordering=th, borde

model.add(Convolution2D(nb_filter=32, nb_row=3, nb_col=3, dim_ordering="th", border_mode="same", bias=False, init="uniform"))

model.add(Convolution2D(nb_filter=32, nb_row=3, nb_col=3, dim_ordering="th", border_mode="same", bias=False, init="uniform"))

model.add(AveragePooling2D(pool_size=(2, 2), dim_ordering="th"))

model.add(Flatten())

model.add(Dense(output_dim=1000, activation="sigmoid"))

model.add(Dense(output_dim=1000, activation="sigmoid"))

model.add(Dense(output_dim=10, activation="sigmoid"))

with open("digits_model.json", "w") as f:

f.write(model.to_json())

plot(model, to_file="digits_model.png", show_shapes=True)

model.compile(loss="mse", optimizer="rmsprop", metrics=["accuracy"])

model.fit(train_digits, train_labels_one_hot, batch_size=32, nb_epoch=10, callbacks=[history])

model.save_weights("digits_model_weights.hdf5")

predict_labels = model.predict_classes(test_digits)

print(classification_report(test_labels, predict_labels))

print(accuracy_score(test_labels, predict_labels))

print(confusion_matrix(test_labels, predict_labels))

五、参考书目

[1]《最优化导论》(美)Edwin K. P. Chong(美)Stanislaw H. Zak

[2]《神经网络设计》(美)Martin T.Hagan(美)Howard B.Demuth(美)Mark Beale

©本文为机器之心转载文章,转载请联系本公众号获得授权

  ?------------------------------------------------

加入机器之心(全职记者/实习生):[email protected]

投稿或寻求报道:[email protected]

广告&商务合作:[email protected]

(责任编辑:本港台直播)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
推荐内容