当前位置: 首页 > wzjs >正文

设计一个网站花多少时间竞价托管服务公司

设计一个网站花多少时间,竞价托管服务公司,网站建设明薇通网络服务好,无锡惠山区建设局网站Python实现神经网络有多种方法。这里我们使用keras框架。你必须安装 tensorflow或theano, 和 keras然后才能实现神经网络。1. 下载数据集并提取训练和测试集(见“NN.ipynb”)from keras.datasets import mnistimport matplotlib.pyplot as plt%matplotlib inline# load (downlo…

Python实现神经网络有多种方法。这里我们使用keras框架。你必须安装 tensorflow或theano, 和 keras然后才能实现神经网络。

1. 下载数据集并提取训练和测试集(见“NN.ipynb”)

from keras.datasets import mnist

import matplotlib.pyplot as plt

%matplotlib inline

# load (downloaded if needed) the MNIST dataset

(X_train, y_train), (X_test, y_test) = mnist.load_data()

# plot 4 images as gray scale

plt.subplot(221)

plt.imshow(X_train[0], cmap=plt.get_cmap('gray'))

plt.subplot(222)

plt.imshow(X_train[1], cmap=plt.get_cmap('gray'))

plt.subplot(223)

plt.imshow(X_train[2], cmap=plt.get_cmap('gray'))

plt.subplot(224)

plt.imshow(X_train[3], cmap=plt.get_cmap('gray'))

# show the plot

plt.show()

4-18. 输出

2. 导入相关包:

import numpy as np

from keras.datasets import mnist

from keras.models import Sequential

from keras.layers import Dense

from keras.layers import Dropout

from keras.utils import np_utils

3. 预处理数据集:

num_pixels = X_train.shape[1] * X_train.shape[2]

# reshape the inputs so that they can be passed to the

vanilla NN

X_train = X_train.reshape(X_train.shape[0],num_pixels

).astype('float32')

X_test = X_test.reshape(X_test.shape[0],num_pixels).

astype('float32')

# scale inputs

X_train = X_train / 255

X_test = X_test / 255

# one hot encode the output

y_train = np_utils.to_categorical(y_train)

y_test = np_utils.to_categorical(y_test)

num_classes = y_test.shape[1]

4. 构建模型:

# building the model

model = Sequential()

# add 1000 units in the hidden layer

# apply relu activation in hidden layer

model.add(Dense(1000, input_dim=num_pixels,activation='relu'))

# initialize the output layer

model.add(Dense(num_classes, activation='softmax'))

# compile the model

model.compile(loss='categorical_crossentropy',optimizer='adam', metrics=['accuracy'])

# extract the summary of model

model.summary()

5. 运行模型:

model.fit(X_train, y_train, validation_data=(X_test,

y_test), epochs=5, batch_size=1024, verbose=1)

注意随着epochs增加, 测试集的准确率也增加。另外在keras里我们只要在第一层指明输入的维,它会自己动的推出余下各层的维。

http://www.dtcms.com/wzjs/146103.html

相关文章:

  • 开发网站需求设计深圳百度seo整站
  • 广州企业网站建设价格百度查重免费入口
  • 部门网站建设怎么做关键词快速排名怎么做
  • 国际网站怎么注册免费的系列推广软文范例
  • 搜索引擎广告有哪些北京优化推广
  • 网站建设包含哪些一份完整的营销策划书
  • html5营销网站建设制作网页模板
  • 寒假网页设计培训珿seo查询seo优化
  • 做企业网站的轻量级cms合肥网络推广网络运营
  • 自学网站建设好学吗武汉新一轮疫情
  • 福州企业网站长沙网红奶茶
  • 东莞 网站建设推广app拉人头赚钱
  • 网站开发主要用什么语言中国免费广告网
  • 石家庄网站建设多少钱上海十大公关公司排名
  • 武汉搭建网站百度点击率排名有效果吗
  • 建筑有限公司官网班级优化大师官网
  • 如何做网站美工的石家庄疫情太严重了
  • 外国做家具的网站济宁seo推广
  • 织梦网站怎么做seo优化百度网站ip地址
  • 政府网站建设的思考个人怎么做百度竞价
  • 旅游主题网站模板外贸推广是做什么的
  • 免费个人网站怎么做百度推广的步骤
  • 常州网站关键词郑州网站seo外包公司
  • 平顶山今日头条新闻德州seo整站优化
  • 导航网站制作 zhihu推广普通话手抄报内容简短
  • 做旅游网站当地人服务赚钱吗个人怎么做百度竞价
  • 教育主管部门建设的专题资源网站是培训公司排名
  • 青岛高端网站开发新东方在线koolearn
  • 云南建设局网站南宁求介绍seo软件
  • 人工做流量的网站廊坊网站建设公司