专家混合模型 – fminunc优化提前停止

我有一个专家混合模型的代码,它在参数数量较少时可以正常工作。代码如下:

global x_au;global x_vi;global x_alpha;global y;global parameter;options = optimoptions(@fminunc,'GradObj', 'on', 'Algorithm','quasi-newton','MaxIter', 10000,'Display','iter-detailed'); % 更改迭代次数optTheta=[];x_au=x_au_train;x_vi=x_vi_train;x_alpha=x_alpha_train;y=y_train;parameter=zeros(8969,1);%期望步骤fprintf('opt1 begins');opt_1;fprintf('opt1 complete');%最大化步骤[x] = fminunc(@costfunction,parameter(1:4483),options);parameter(1:4483)=x;resnorm1=total_error(parameter(1:4483));k=1;count = 1;while(1)opt_1; fprintf('expectation complete');%最大化步骤[x] = fminunc(@costfunction,parameter(1:4483),options);parameter(1:4483)=x;resnorm2=total_error(parameter(1:4483));fprintf('resnorm1-resnorm2 - %f, resnorm2 - %f, k - %f',resnorm1-resnorm2,0.000001*resnorm2,k);if((resnorm1-resnorm2)< .000001*resnorm2 & k~=1)  %% 为了减少训练时间     break;end

但是现在,当我需要将它应用于参数数量较大的问题时,我得到了以下日志。

                                                     First-order  Iteration  Func-count       f(x)        Step-size       optimality     0           1      5.31444e+10                      4.75e+14Optimization stopped because the objective function cannot be decreased in the current search direction. Either the predicted change in the objective function,or the line search interval is less than eps.                                                   First-order  Iteration  Func-count       f(x)        Step-size       optimality     0           1      5.31444e+10                      4.75e+14Optimization stopped because the objective function cannot be decreased in the current search direction. Either the predicted change in the objective function,or the line search interval is less than eps.resnorm1-resnorm2 - 0.000000, resnorm2 - 53144.356560, k - 1.000000                                                     First-order  Iteration  Func-count       f(x)        Step-size       optimality     0           1      5.31444e+10                      4.75e+14Optimization stopped because the objective function cannot be decreased in the current search direction. Either the predicted change in the objective function,or the line search interval is less than eps.    resnorm1-resnorm2 - 0.000000, resnorm2 - 53144.356560, k - 2.000000>> 

然后过程以非常糟糕的结果完成。可以看出,fminunc无法正确优化。谁能帮帮我?


回答:

我将参数初始化从零改为随机数,并结合归一化处理,最终使其正常工作。

Related Posts

Keras Dense层输入未被展平

这是我的测试代码: from keras import…

无法将分类变量输入随机森林

我有10个分类变量和3个数值变量。我在分割后直接将它们…

如何在Keras中对每个输出应用Sigmoid函数?

这是我代码的一部分。 model = Sequenti…

如何选择类概率的最佳阈值?

我的神经网络输出是一个用于多标签分类的预测类概率表: …

在Keras中使用深度学习得到不同的结果

我按照一个教程使用Keras中的深度神经网络进行文本分…

‘MatMul’操作的输入’b’类型为float32,与参数’a’的类型float64不匹配

我写了一个简单的TensorFlow代码,但不断遇到T…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注