深度学习模型-稀疏自编码matlab算法,内带数据集可直接运行。


深度学习模型-稀疏自编码matlab算法,内带数据集可直接运行。
资源截图
代码片段和文件信息
function [] = checkNumericalGradient()
% This code can be used to check your numerical gradient implementation 
% in computeNumericalGradient.m
% It analytically evaluates the gradient of a very simple function called
% simpleQuadraticFunction (see below) and compares the result with your numerical
% solution. Your numerical gradient implementation is incorrect if
% your numerical solution deviates too much from the analytical solution.
  
% Evaluate the function and gradient at x = [4; 10]; (Here x is a 2d vector.)
x = [4; 10];
[value grad] = simpleQuadraticFunction(x);

% Use your code to numerically compute the gradient of simpleQuadraticFunction at x.
% (The notation “@simpleQuadraticFunction“ denotes a pointer to a function.)
numgrad = computeNumericalGradient(@simpleQuadraticFunction x);

% Visually examine the two gradient computations.  The two columns
% you get should be very similar. 
disp([numgrad grad]);
fprintf(‘The above two columns you get should be very similar.
(Left-Your Numerical Gradient Right-Analytical Gradient)

‘);

% Evaluate the norm of the difference between two solutions.  
% If you have a correct implementation and assuming you used EPSILON = 0.0001 
% in computeNumericalGradient.m then diff below should be 2.1452e-12 
diff = norm(numgrad-grad)/norm(numgrad+grad);
disp(diff); 
fprintf(‘Norm of the difference between numerical and analytical gradient (should be < 1e-9)

‘);
end


  
function [valuegrad] = simpleQuadraticFunction(x)
% this function accepts a 2D vector as input. 
% Its outputs are:
%   value: h(x1 x2) = x1^2 + 3*x1*x2
%   grad: A 2x1 vector that gives the partial derivatives of h with respect to x1 and x2 
% Note that when we pass @simpleQuadraticFunction(x) to computeNumericalGradients we‘re assuming
% that computeNumericalGradients will use only the first returned value of this function.

value = x(1)^2 + 3*x(1)*x(2);

grad = zeros(2 1);
grad(1)  = 2*x(1) + 3*x(2);
grad(2)  = 3*x(1);

end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-01-06 02:46  starter
     目录           0  2011-01-04 05:38  starterminFunc
     文件        3251  2011-01-04 05:39  starterminFuncArmijoBacktrack.m
     文件         807  2011-01-04 05:39  starterminFuncautoGrad.m
     文件         901  2011-01-04 05:39  starterminFuncautoHess.m
     文件         317  2011-01-04 05:39  starterminFuncautoHv.m
     文件         870  2011-01-04 05:39  starterminFuncautoTensor.m
     文件         385  2011-01-04 05:39  starterminFunccallOutput.m
     文件        1845  2011-01-04 05:39  starterminFuncconjGrad.m
     文件         995  2011-01-04 05:39  starterminFuncdampedUpdate.m
     文件        2421  2011-01-04 05:39  starterminFuncexample_minFunc.m
     文件        1604  2011-01-04 05:39  starterminFuncexample_minFunc_LR.m
     文件         107  2011-01-04 05:39  starterminFuncisLegal.m
     文件         924  2011-01-04 05:39  starterminFunclbfgs.m
     文件        2408  2011-01-04 05:39  starterminFunclbfgsC.c
     文件        7707  2011-01-04 05:39  starterminFunclbfgsC.mexa64
     文件        7733  2011-01-04 05:39  starterminFunclbfgsC.mexglx
     文件        9500  2011-01-04 05:39  starterminFunclbfgsC.mexmac
     文件        7168  2011-01-04 05:39  starterminFunclbfgsC.mexw32
     文件        9728  2011-01-04 05:39  starterminFunclbfgsC.mexw64
     文件         614  2011-01-04 05:39  starterminFunclbfgsUpdate.m
     目录           0  2011-01-04 05:38  starterminFunclogistic
     文件         417  2011-01-04 05:39  starterminFunclogisticLogisticDiagPrecond.m
     文件         216  2011-01-04 05:39  starterminFunclogisticLogisticHv.m
     文件         659  2011-01-04 05:39  starterminFunclogisticLogisticLoss.m
     文件        1154  2011-01-04 05:39  starterminFunclogisticmexutil.c
     文件         317  2011-01-04 05:39  starterminFunclogisticmexutil.h
     文件         227  2011-01-04 05:39  starterminFunclogisticmylogsumexp.m
     文件        3965  2011-01-04 05:39  starterminFunclogistic
epmatC.c
     文件        7680  2011-01-04 05:39  starterminFunclogistic
epmatC.dll
     文件       20682  2011-01-04 05:39  starterminFunclogistic
epmatC.mexglx
............此处省略26个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)