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

随州网站建设有限公司iis8出现在网站首页

随州网站建设有限公司,iis8出现在网站首页,wordpress首页排版,Wordpress慢加内存还是带宽前言 前面学习了受限玻尔兹曼机(RBM)的理论和搭建方法, 如果稍微了解过的人, 肯定知道利用RBM可以堆叠构成深度信念网络(deep belief network, DBN)和深度玻尔兹曼机(deep Boltzmann machine), 这里就先学习一下DBN. 国际惯例, 参考博文: Deep Belief Networks A fast lear…前言 前面学习了受限玻尔兹曼机(RBM)的理论和搭建方法, 如果稍微了解过的人, 肯定知道利用RBM可以堆叠构成深度信念网络(deep belief network, DBN)和深度玻尔兹曼机(deep Boltzmann machine), 这里就先学习一下DBN. 国际惯例, 参考博文: Deep Belief Networks A fast learning algorithm for deep belief nets 理论 DBN的网络结构就是简单地将RBM堆叠起来, 样子长得就跟全连接一样. 由于它也是图模型, 所以很容易写出所有层的联合分布, 需要注意的是训练方法是逐层训练, 也就是说每两层是作为一个RBM训练的, 与其它层无关, 也即遇到类似于P(h2|x,h1)P(h_2|x,h_1)的可以直接写成P(h2|h1)P(h_2|h_1), 表示h2h_2的训练与xx无关, 了解到这, 我们就可以写联合分布了, 注意为了保持与教程一致, 此处采用的是以隐层为条件的可见层概率分布, 其实常规思维是以可见层为条件的隐层概率分布, 依据我前面介绍过的图模型联合概率分布计算方法: P(x,h1,h2,⋯,hl)=P(hl)P(hl−1|hl)∗P(hl−2|hl−1,hl)∗⋯P(x|hl,hl−1,⋯,h1)=P(hl)P(hl−1|hl)∗P(hl−2|hl−1)∗⋯∗P(x|h1)=P(hl,hl−1)Πl−2k=0(P(hk|hk+1)) \begin{aligned} P(x,h_1,h_2,\cdots,h_l)xh_0=x, 进而整个DBN的训练方法就显而易见了: 将第一层作为一个RBM训练, 输入是xh(0)x=h^{(0)}, 作为可见层将第一层得到是输入表示作为第二层的数据输入, 有两种方案, 可以使用P(h(1)1|h(0))P(h^{(1)}=1|h^{(0)})的平均激活, 或者是从P(h(1)|h(0))P(h^{(1)}|h^{(0)})采样, 个人觉得前者是针对二值输入, 后者是真对实值输入将第二层作为RBM训练, 将变换数据(样本或均值激活)作为训练样本重复第二步和第三步最后就是微调整个网络参数,就是传说中的fine-tuning, 两种方法, 第一种是使用负对数似然损失的代理方法, 其实论文里面说的就是从上之下的一个算法, 也是Hinton大佬发明的wake-sleep算法, 这个算法经常被用于预训练AE(详细请看《视觉机器学习20讲》); 另一种方法就是有监督学习算法, 在模型顶上加个分类器作为误差传递的来源. 在教程中, 主要关注监督梯度下降的微调算法, 具体来说就是使用Logistic回归分类器基于DBN最后一层隐单元的输出对输入xx分类. 随后通过负对数似然损失来执行有监督梯度下降, 由于有监督梯度对于权重和隐单元偏置非零(对每层RBM的可见层是零), 这就等价于通过无监督的方式, 为一个深层多层感知器(MLP)进行权重和隐单元偏置的初始化.为什么这种训练方法有效?拿具有两个隐层(h(1),h(2)h^{(1)},h^{(2)})的DBN来说, 权重分别为W(1),W(2)W^{(1)},W^{(2)}, Hinton在论文 中建立了一个式子logp(x)\log p(x), 如果不懂这个符号的含义, 建议去看看RBM的证明, 戳这里有一个非常非常好的RBM证明文档, 极为清晰, 极力推荐去看看. logp(x)KL(Q(h(1)|x)∥p(h(1)|x))HQ(h(1)|x)∑hQ(h(1)|x)(logp(h(1))logp(x|h(1)))\begin{aligned} \log p(x)=KL(Q(h(1)|x)∥p(h(1)|x))HQ(h(1)|x)∑hQ(h(1)|x)(logp(h(1))logp(x|h(1)))∑hH(Q(h(1)|x),p(h(1)|x))−H(Q(h(1)|x))HQ(h(1)|x)∑hQ(h(1)|x)[logp(h(1))logp(x|h(1))]−∑hQ(h(1)|x)logp(h(1)|x)∑hQ(h(1)|x)[logp(h(1))logp(x|h(1))]\begin{aligned} \log p(x)0KL(Q(h^{(1)}|x)|p(h^{(1)}|x))=0, 即由模型根据输入向量得到的特征向量与原始数据本来的真正的特征向量相等, 那么Q(h(1)|x)p(h(1)|x)Q(h^{(1)}|x)=p(h^{(1)}|x), 最终上式结果可以写成 logp(x)−∑hQ(h(1)|x)logQ(h(1)|x)∑hQ(h(1)|x)[logp(h(1))logp(x|h(1))]\log p(x)=-\sum_h Q(h^{(1)}|x)\log Q(h^{(1)}|x)+\sum_hQ(h^{(1)}|x)\left[\log p(h^{(1)})+\log p(x|h^{(1)})\right]可以发现这个式子与论文的式子完全相同.正如论文说的, h(0)h^{(0)}是第一个隐层的二值向量, p(h(0))p(h^{(0)})是当前模型h(0)h^{(0)}的先验概率, Q(⋅|x)Q(\cdot |x)是基于第一层隐层为条件的任意概率分布, 边界就是当且仅当Q(⋅|x)Q(\cdot|x)是真实的后验分布. 当所有的权重被绑定在一起的时候, 将WT1W_1^{T}应用到数据向量计算得到基于h(1)h^{(1)}的因子分布是真实的后验分布. 因而在贪婪算法的第二步logp(x)\log p(x)是等于边界的. 第二步将Q(⋅|x)Q(\cdot|x)和p(x|h(1))p(x|h^{(1)})固定, 边界的导数与下式的导数一样 ∑Q(h(1)|x)logp(h(1))\sum Q(h^{(1)}|x)\log p(h^{(1)})因而最大化高层的比如说权重的边界实际上等价于最大化数据集的对数概率, 其中h(1)h^{(1)}是由Q(h(1)|x)Q(h^{(1)}|x)产生的. 如果边界变得更加紧密, logp(x)\log p(x)有极大可能降低, 即使基于它的较低的边界增加, 但是logp(x)\log p(x)不会低于第二步贪婪算法得到的它的值, 因为边界是很紧密的而且经常处于上升趋势代码实现 可以发现DBN与SdA非常相似, 因为他们都是无监督的层级训练, 主要区别就是DBN使用层级训练基础是RBM, 而SdA使用的层级训练基础是dA. 最好复习一下dA的梯度是由什么损失函数得到的, 这样有助于与RBM做一个区分. 因为采用DBN做无监督训练, 然后采用MLP微调, 所以直接先建立一个DBN类去作为MLP的层. 因而还是需要用到我们之前的代码, 包含: 引入各种包 import numpy as np import theano import theano.tensor as T from theano.tensor.shared_randomstreams import RandomStreams import cPickle,gzip from PIL import Image import pylab import os读取数据的函数 #定义读数据的函数,把数据丢入到共享区域def load_data(dataset):data_dir,data_fileos.path.split(dataset)if os.path.isfile(dataset):with gzip.open(dataset,rb) as f:train_set,valid_set,test_setcPickle.load(f)#共享数据集def shared_dataset(data_xy,borrowTrue):data_x,data_ydata_xyshared_xtheano.shared(np.asarray(data_x,dtypetheano.config.floatX),borrowborrow)shared_ytheano.shared(np.asarray(data_y,dtypetheano.config.floatX),borrowborrow)return shared_x,T.cast(shared_y,int32)#定义三个元组分别存储训练集,验证集,测试集train_set_x,train_set_yshared_dataset(train_set)valid_set_x,valid_set_yshared_dataset(valid_set)test_set_x,test_set_yshared_dataset(test_set)rval[(train_set_x,train_set_y),(valid_set_x,valid_set_y),(test_set_x,test_set_y)]return rval定义RBM作为预训练的基础, 主要有positive phase、negative phase, 构成Gibbs sampling, 还有能量函数的定义以及使用能量函数做梯度更新的方法 #定义RBMclass RBM(object):def __init__(self,rngNone,trngNone,inputNone,n_visible784,n_hidden500,WNone,hbiasNone,vbiasNone):self.n_visiblen_visibleself.n_hiddenn_hiddenif rng is None:rngnp.random.RandomState(1234)if trng is None:trngRandomStreams(rng.randint(2**30))#初始化权重和偏置 if W is None:initWnp.asarray(rng.uniform(low-4*np.sqrt(6./(n_hiddenn_visible)),high4*np.sqrt(6./(n_hiddenn_visible)),size(n_visible,n_hidden)),dtypetheano.config.floatX)Wtheano.shared(valueinitW,nameW,borrowTrue)if hbias is None:inithbiasnp.zeros(n_hidden,dtypetheano.config.floatX)hbiastheano.shared(valueinithbias,namehbias,borrowTrue)if vbias is None:initvbiasnp.zeros(n_visible,dtypetheano.config.floatX)vbiastheano.shared(valueinitvbias,namevbias,borrowTrue)self.inputinputif not input:self.inputT.matrix(input)self.WWself.hbiashbiasself.vbiasvbiasself.trngtrngself.params[self.W,self.hbias,self.vbias]##########前向计算,从可见层到隐层#################激活概率def propup(self,vis):pre_sigmoid_activationT.dot(vis,self.W)self.hbiasreturn [pre_sigmoid_activation,T.nnet.sigmoid(pre_sigmoid_activation)]#二值激活def sample_h_given_v(self,v0_samples):pre_sigmoid_h1,h1_meanself.propup(v0_samples)h1_sampleself.trng.binomial(sizeh1_mean.shape,n1,ph1_mean,dtypetheano.config.floatX)return [pre_sigmoid_h1,h1_mean,h1_sample]##########反向计算,从隐层到可见层#################激活概率def propdown(self,hid):pre_sigmoid_activationT.dot(hid,self.W.T)self.vbiasreturn [pre_sigmoid_activation,T.nnet.sigmoid(pre_sigmoid_activation)]#二值激活def sample_v_given_h(self,h0_samples):pre_sigmoid_v1,v1_meanself.propdown(h0_samples)v1_sampleself.trng.binomial(sizev1_mean.shape,n1,pv1_mean,dtypetheano.config.floatX)return [pre_sigmoid_v1,v1_mean,v1_sample]##########吉布斯采样#################可见层-隐层-可见层def gibbs_vhv(self,v0_samples):pre_sigmoid_h1,h1_mean,h1_sampleself.sample_h_given_v(v0_samples)pre_sigmoid_v1,v1_mean,v1_sampleself.sample_v_given_h(h1_sample)return [pre_sigmoid_v1,v1_mean,v1_sample,pre_sigmoid_h1,h1_mean,h1_sample]############自由能量函数###############def free_energy(self,v_samples):wx_bT.dot(v_samples,self.W)self.hbiasvbias_termT.dot(v_samples,self.vbias)#第一项hidden_termT.sum(T.log(1T.exp(wx_b)),axis1)#第二项return -hidden_term-vbias_term############梯度更新#################def get_cost_updates(self,lr0.1,k1):([pre_sigmoid_nvs,nv_means,nv_samples,pre_sigmoid_nhs,nh_means,nh_samples],updates)\theano.scan(self.gibbs_vhv,outputs_info[None,None,self.input,None,None,None],n_stepsk,namegibbs_vhv)chain_endnv_samples[-1]costT.mean(self.free_energy(self.input))-T.mean(self.free_energy(chain_end))gparamsT.grad(cost,self.params,consider_constant[chain_end])for gparam,param in zip(gparams,self.params):updates[param]param-gparam*T.cast(lr,dtypetheano.config.floatX)##################期望看到交叉熵损失##############monitor_costself.get_reconstruction_cost(pre_sigmoid_nvs[-1])return monitor_cost,updates########非持续性对比散度,重构误差#########def get_reconstruction_cost(self,pre_sigmoid_nv):cross_entropyT.mean(T.sum(self.input*T.log(T.nnet.sigmoid(pre_sigmoid_nv))\(1-self.input)*T.log(1-T.nnet.sigmoid(pre_sigmoid_nv)),axis1))return cross_entropy搭建MLP需要的隐层定义 #定义多层感知器的隐层单元相关操作class HiddenLayer(object):def __init__(self,rng,input,n_in,n_out,WNone,bNone,activationT.tanh):self.inputinputif W is None:W_valuesnp.asarray(rng.uniform(low- np.sqrt(6./(n_inn_out)),high np.sqrt(6./(n_inn_out)),size(n_in,n_out)),dtypetheano.config.floatX)if activationT.nnet.sigmoid:W_values * 4Wtheano.shared(valueW_values,nameW,borrowTrue)if b is None:b_vaulesnp.zeros((n_out,),dtypetheano.config.floatX)btheano.shared(valueb_vaules,nameb,borrowTrue)self.WWself.bblin_outputT.dot(input,self.W)self.b#未被激活的线性操作self.output(lin_output if activation is None else activation(lin_output))self.params[self.W,self.b]最后微调需要softmax #定义最后一层softmaxclass LogisticRegression(object):def __init__(self,input,n_in,n_out):#共享权重self.Wtheano.shared(valuenp.zeros((n_in,n_out),dtypetheano.config.floatX),nameW,borrowTrue)#共享偏置self.btheano.shared(valuenp.zeros((n_out,),dtypetheano.config.floatX),nameb,borrowTrue)#softmax函数self.p_y_given_xT.nnet.softmax(T.dot(input,self.W)self.b)#预测值self.y_predT.argmax(self.p_y_given_x,axis1)self.params[self.W,self.b]#模型参数self.inputinput#模型输入#定义负对数似然def negative_log_likelihood(self,y):return -T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]),y])#定义误差def errors(self, y):# check if y has same dimension of y_predif y.ndim ! self.y_pred.ndim:raise TypeError(y should have the same shape as self.y_pred,(y, y.type, y_pred, self.y_pred.type))# check if y is of the correct datatypeif y.dtype.startswith(int):# the T.neq operator returns a vector of 0s and 1s, where 1# represents a mistake in predictionreturn T.mean(T.neq(self.y_pred, y))else:raise NotImplementedError() 准备工作完成以后, 可以进行DBN的定义了, 首先定义结构, 主要包含多个隐层, RBM的逐层训练, 由于MLP和多个RBM是共享隐单元的, 所以无需重复定义, 但是最后需要使用softmax层作为微调梯度的来源. class DBN(object):def __init__(self,rngNone,trngNone,n_visible784,n_hidden[500,500],n_out10):self.sigmoid_layers[]self.rbm_layers[]self.params[]self.n_layerslen(n_hidden)assert self.n_layers0if not trng:trngRandomStreams(rng.randint(2**30))self.xT.matrix(x)#输入self.yT.ivector(y)#标签for i in range(self.n_layers):#初始化各隐层if i0:input_sizen_visibleelse:input_sizen_hidden[i-1]if i0:layer_inputself.xelse:layer_inputself.sigmoid_layers[-1].output#建立隐层sigmoid_layerHiddenLayer(rngrng,inputlayer_input,n_ininput_size,n_outn_hidden[i],activationT.nnet.sigmoid)self.sigmoid_layers.append(sigmoid_layer)self.params.extend(sigmoid_layer.params)#逐层预训练rbm_layerRBM(rngrng,trngtrng,inputlayer_input,n_visibleinput_size,n_hiddenn_hidden[i],Wsigmoid_layer.W,hbiassigmoid_layer.b)self.rbm_layers.append(rbm_layer)#微调分类层self.logLayerLogisticRegression(inputself.sigmoid_layers[-1].output,n_inn_hidden[-1],n_outn_out)self.params.extend(self.logLayer.params)self.finetune_costself.logLayer.negative_log_likelihood(self.y)self.errorsself.logLayer.errors(self.y) 这里一定要注意微调分类层不是包含在for循环中的, 虽然大家都知道, 但是写代码就是容易发生这个对齐情况, 我当时就写错了, 找了半天错误, 错误提示是 构建DBN 预训练开始 第0层第0次迭代, 损失-98 第1层第0次迭代, 损失-332 第2层第0次迭代, 损失-52 开始微调 --------------------------------------------------------------------------- DisconnectedInputError Traceback (most recent call last) ipython-input-13-1ad031bf1afb in module() ---- 1 test_DBN()ipython-input-12-1ea97c3e407d in test_DBN(pretrain_lr, k, pretrain_epoches, finetune_lr, train_epoch, dataset, batch_size)18 print(第%d层第%d次迭代, 损失%d %(i,epoch,np.mean(c,dtypefloat64)))19 print(开始微调) --- 20 train_fn,validate_model,test_modeldbn.finetune(datasetsdatasets,batch_sizebatch_size,learning_ratefinetune_lr)21 patience4*n_train_batches22 patience_inc2.0ipython-input-11-f24396c0dd18 in finetune(self, datasets, batch_size, learning_rate)78 79 indexT.lscalar(index) --- 80 gparamsT.grad(self.finetune_cost,self.params)81 updates[]82 for param,gparam in zip(self.params,gparams):C:\ProgramData\Anaconda2\lib\site-packages\theano\gradient.pyc in grad(cost, wrt, consider_constant, disconnected_inputs, add_names, known_grads, return_disconnected, null_gradients)537 if elem not in var_to_app_to_idx and elem is not cost \538 and elem not in grad_dict: -- 539 handle_disconnected(elem)540 grad_dict[elem] disconnected_type()541 C:\ProgramData\Anaconda2\lib\site-packages\theano\gradient.pyc in handle_disconnected(var)524 elif disconnected_inputs raise:525 message utils.get_variable_trace_string(var) -- 526 raise DisconnectedInputError(message)527 else:528 raise ValueError(Invalid value for keyword DisconnectedInputError: Backtrace when that variable is created:File C:\ProgramData\Anaconda2\lib\site-packages\ipykernel\zmqshell.py, line 533, in run_cellreturn super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)File C:\ProgramData\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py, line 2718, in run_cellinteractivityinteractivity, compilercompiler, resultresult)File C:\ProgramData\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py, line 2828, in run_ast_nodesif self.run_code(code, result):File C:\ProgramData\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py, line 2882, in run_codeexec(code_obj, self.user_global_ns, self.user_ns)File ipython-input-13-1ad031bf1afb, line 1, in moduletest_DBN()File ipython-input-12-1ea97c3e407d, line 10, in test_DBNdbnDBN(rngrng,trngRandomStreams(rng.randint(2**30)),n_visible28*28,n_hidden[1000, 500, 400],n_out10)File ipython-input-11-f24396c0dd18, line 49, in __init__n_outn_out)File ipython-input-5-22c6bb9a49a7, line 7, in __init__borrowTrue) 然后就可以定义预训练过程了,逐层更新, 依旧是使用for循环 def pretrain(self,train_set,batch_size,k):indexT.lscalar(index)learning_rateT.scalar(lr)batch_beginindex*batch_sizebatch_endbatch_beginbatch_sizepretrain_fns[]for rbm in self.rbm_layers:cost,updatesrbm.get_cost_updates(learning_rate,kk)fntheano.function(inputs[index,theano.In(learning_rate,value0.1)],outputscost,updatesupdates,givens{self.x:train_set[batch_begin:batch_end]})pretrain_fns.append(fn)return pretrain_fns 微调阶段与MLP的构建一样, 利用训练集更新参数, 利用验证集和测试集查看模型效果 def finetune(self,datasets,batch_size,learning_rate):(train_set_x,train_set_y)datasets[0](valid_set_x,valid_set_y)datasets[1](test_set_x,test_set_y)datasets[2]n_valid_batchesvalid_set_x.get_value(borrowTrue).shape[0]n_valid_batches//batch_sizen_test_batchestest_set_x.get_value(borrowTrue).shape[0]n_test_batches//batch_sizeindexT.lscalar(index)gparamsT.grad(self.finetune_cost,self.params)updates[]for param,gparam in zip(self.params,gparams):updates.append((param,param-gparam*learning_rate))train_fntheano.function(inputs[index],outputsself.finetune_cost,updatesupdates,givens{self.x:train_set_x[index*batch_size:(index1)*batch_size],self.y:train_set_y[index*batch_size:(index1)*batch_size]})valid_scoretheano.function(inputs[index],outputsself.errors,givens{self.x:valid_set_x[index*batch_size:(index1)*batch_size],self.y:valid_set_y[index*batch_size:(index1)*batch_size]})test_scoretheano.function(inputs[index],outputsself.errors,givens{self.x:test_set_x[index*batch_size:(index1)*batch_size],self.y:test_set_y[index*batch_size:(index1)*batch_size]}) 对于验证集和测试集, 我们希望得到准确率信息 def valid():return [valid_score(i) for i in range(n_valid_batches)]def test():return [test_score(i) for i in range(n_test_batches)]return train_fn,valid,test 最终运行阶段, 首先初始化一个DBN网络 datasetsload_data(dataset)train_set_x,train_set_ydatasets[0]n_train_batchestrain_set_x.get_value(borrowTrue).shape[0]//batch_sizeprint(构建DBN)rngnp.random.RandomState(123)trngRandomStreams(rng.randint(2**30))dbnDBN(rngrng,trngRandomStreams(rng.randint(2**30)),n_visible28*28,n_hidden[500, 200, 100],n_out10) 然后正式逐层RBM预训练 print(预训练开始)pretrain_fnsdbn.pretrain(train_settrain_set_x,batch_sizebatch_size,kk)for i in range(dbn.n_layers):for epoch in range(pretrain_epoches):c[]for batch_index in range(n_train_batches):c.append(pretrain_fns[i](indexbatch_index,lrpretrain_lr))print(第%d层第%d次迭代, 损失%d %(i,epoch,np.mean(c,dtypefloat64))) 提前终止算法微调 print(开始微调)train_fn,validate_model,test_modeldbn.finetune(datasetsdatasets,batch_sizebatch_size,learning_ratefinetune_lr)patience4*n_train_batchespatience_inc2.0imp_threshold0.995valid_frequencemin(n_train_batches,patience/2)best_lossnp.inftest_socre0.0done_loopFalseepoch0while(epochtrain_epoch) and (not done_loop):epochepoch1for minibatch_index in range(n_train_batches):train_fn(minibatch_index)iter(epoch-1)*n_train_batchesminibatch_indexif (iter1)%valid_frequence0:valid_lossvalidate_model()this_valid_lossnp.mean(valid_loss,dtypefloat64)print(第%d次迭代, 第%d个批次,验证误差为%f %% %(epoch,minibatch_index1,this_valid_loss*100))if this_valid_lossbest_loss:if this_valid_lossbest_loss*imp_threshold:patiencemax(patience,iter*patience_inc)best_lossthis_valid_lossbest_iteritertest_losstest_model()test_scorenp.mean(test_loss,dtypefloat64)print(第%d次训练, 第%d批数据,测试误差为%f %% %(epoch,minibatch_index1,test_score*100.0))if patienceiter:done_loopTruebreak 模型的保存方法就不写了, 和MLP的差不多, 主要还是因为我python不是特别好, 搞不好又出一堆错误, 训练结果如下: 构建DBN 预训练开始 第0层第0次迭代, 损失-106 第1层第0次迭代, 损失-180 第2层第0次迭代, 损失-38 开始微调 第1次迭代, 第5000个批次,验证误差为5.360000 % 第1次训练, 第5000批数据,测试误差为6.100000 % 第2次迭代, 第5000个批次,验证误差为4.100000 % 第2次训练, 第5000批数据,测试误差为4.510000 % 第3次迭代, 第5000个批次,验证误差为3.490000 % 第3次训练, 第5000批数据,测试误差为4.030000 % 第4次迭代, 第5000个批次,验证误差为3.250000 % 第4次训练, 第5000批数据,测试误差为3.560000 % 第5次迭代, 第5000个批次,验证误差为3.020000 % 第5次训练, 第5000批数据,测试误差为3.320000 % 第6次迭代, 第5000个批次,验证误差为2.830000 % 第6次训练, 第5000批数据,测试误差为3.220000 % 第7次迭代, 第5000个批次,验证误差为2.790000 % 第7次训练, 第5000批数据,测试误差为2.990000 % 第8次迭代, 第5000个批次,验证误差为2.650000 % 第8次训练, 第5000批数据,测试误差为2.800000 % 第9次迭代, 第5000个批次,验证误差为2.600000 % 第9次训练, 第5000批数据,测试误差为2.690000 % 第10次迭代, 第5000个批次,验证误差为2.620000 % 第11次迭代, 第5000个批次,验证误差为2.570000 % 第11次训练, 第5000批数据,测试误差为2.580000 % 第12次迭代, 第5000个批次,验证误差为2.480000 % 第12次训练, 第5000批数据,测试误差为2.580000 % 第13次迭代, 第5000个批次,验证误差为2.460000 % 第13次训练, 第5000批数据,测试误差为2.590000 % 第14次迭代, 第5000个批次,验证误差为2.440000 % 第14次训练, 第5000批数据,测试误差为2.520000 % 第15次迭代, 第5000个批次,验证误差为2.370000 % 第15次训练, 第5000批数据,测试误差为2.500000 % 第16次迭代, 第5000个批次,验证误差为2.320000 % 第16次训练, 第5000批数据,测试误差为2.460000 % 第17次迭代, 第5000个批次,验证误差为2.310000 % 第17次训练, 第5000批数据,测试误差为2.510000 % 第18次迭代, 第5000个批次,验证误差为2.310000 % 第19次迭代, 第5000个批次,验证误差为2.260000 % 第19次训练, 第5000批数据,测试误差为2.430000 % 第20次迭代, 第5000个批次,验证误差为2.230000 % 第20次训练, 第5000批数据,测试误差为2.360000 % 后记 自己写代码的时候主要就是刚才提到的那个对齐错误, 导致整个程序的错误日志有点看不懂, 大概意思就是梯度更新的位置出现了问题, 但是导致梯度出问题的原因可能有很多, 当代码量较大的时候就不太好查找了, 所以大家写代码一定要仔细仔细仔细. 博文代码:链接: https://pan.baidu.com/s/1gfaTR6z 密码: fhe2
http://www.zqtcl.cn/news/81601/

相关文章:

  • 建设实验教学网站的作用石家庄建设信息网
  • 聚名网账号购买网站优化怎么做 百度文库
  • 宁夏网站制作企业网站建设价格
  • 学校能建设网站吗万网 做网站
  • 网站建设实训周记网站群建设讲话
  • 江门网站建设联系电话定制开发小程序
  • 一些你不知道的网站搜云seo
  • 网站建设-信科网络摄影设计说明范文
  • 网站的友情链接做多少个比较合适厦门网站制作公司找哪家
  • 青岛网站改版开发公司工程部工作总结
  • 广宁城乡建设网站19互动网站建设
  • 阿里巴巴企业网站建设粉红色的网站首页
  • 西安汽车网站制作枸杞网站怎么做
  • 诸暨东莞网站建设公司成都网络公司网站建设
  • 珠海电商网站制作深圳网站建设公司制作定制
  • 保定网站设计优势南昌网站推广策划
  • 网站你懂我意思正能量免费app开发定制公司如何选择
  • 品牌建设标语欧美seo查询
  • 网站建设多少钱一年做购物网站用什么应用
  • 免费网站空间phpwordpress评论设置
  • 家电设计网站seo英文全称
  • 海外网站空间大连专业制作网站
  • 揭阳新站seo方案网络信息
  • 朝阳区互联网公司排名seo1网站查询
  • 广州网站建设服务商一起装修网官网
  • 佛山建设企业网站做站长工具网站
  • 龙胜做网站的公司网站注册费用需要多钱
  • 网站建设文字教程北京家装设计师排名
  • 一台电脑如何做网站wordpress回复页面
  • 网站开发全程设计新风格网站