资源简介
machine-learning-ex4
代码片段和文件信息
function checkNNGradients(lambda)
%CHECKNNGRADIENTS Creates a small neural network to check the
%backpropagation gradients
% CHECKNNGRADIENTS(lambda) Creates a small neural network to check the
% backpropagation gradients it will output the analytical gradients
% produced by your backprop code and the numerical gradients (computed
% using computeNumericalGradient). These two gradient computations should
% result in very similar values.
%
if ~exist(‘lambda‘ ‘var‘) || isempty(lambda)
lambda = 0;
end
input_layer_size = 3;
hidden_layer_size = 5;
num_labels = 3;
m = 5;
% We generate some ‘random‘ test data
Theta1 = debugInitializeWeights(hidden_layer_size input_layer_size);
Theta2 = debugInitializeWeights(num_labels hidden_layer_size);
% Reusing debugInitializeWeights to generate X
X = debugInitializeWeights(m input_layer_size - 1);
y = 1 + mod(1:m num_labels)‘;
% Unroll parameters
nn_params = [Theta1(:) ; Theta2(:)];
% Short hand for cost function
costFunc = @(p) nnCostFunction(p input_layer_size hidden_layer_size ...
num_labels X y lambda);
[cost grad] = costFunc(nn_params);
numgrad = computeNumericalGradient(costFunc nn_params);
% 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.\n‘ ...
‘(Left-Your Numerical Gradient Right-Analytical Gradient)\n\n‘]);
% 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 less than 1e-9
diff = norm(numgrad-grad)/norm(numgrad+grad);
fprintf([‘If your backpropagation implementation is correct then \n‘ ...
‘the relative difference will be small (less than 1e-9). \n‘ ...
‘\nRelative Difference: %g\n‘] diff);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 1950 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\checkNNGradients.m
....... 1095 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\computeNumericalGradient.m
....... 841 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\debugInitializeWeights.m
....... 1502 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\displayData.m
....... 8099 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\ex4.m
....... 7511764 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\ex4data1.mat
....... 79592 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\ex4weights.mat
....... 8749 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\fmincg.m
....... 1624 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\AUTHORS.txt
....... 3862 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\ChangeLog.txt
....... 881 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\jsonopt.m
....... 1551 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\LICENSE_BSD.txt
....... 18732 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\loadjson.m
....... 15574 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\loadubjson.m
....... 771 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\mergestruct.m
....... 19369 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\README.txt
....... 17462 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\savejson.m
....... 16123 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\saveubjson.m
....... 1094 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab\varargin2struct.m
....... 1195 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\makeValidFieldName.m
....... 5562 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\submitWithConfiguration.m
....... 3210 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\nnCostFunction.m
....... 585 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\predict.m
....... 903 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\randInitializeWeights.m
....... 137 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\sigmoid.m
....... 677 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\sigmoidGradient.m
....... 1635 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\submit.m
....... 356692 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4.pdf
目录 0 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib\jsonlab
目录 0 2017-03-14 09:40 machine-learning-ex4\machine-learning-ex4\ex4\lib
............此处省略6个文件信息
相关资源
- 目标分类网络总结
- PRML-Solutions to Exercises Tutors Edition
- 斯坦福大学 2014 机器学习教程中文笔
- 重庆大学软件学院机器学习ppt
- 论文研究-基于改进贝叶斯优化算法的
- 基于模糊控制与神经网络的智能PID温
- 论文研究-基于卷积神经网络的图像隐
- 斯坦福大学 2014 机器学习教程个人笔
- Bayesian Networks With Examples in R280858
- 吴恩达机器学习课件
- 张志华《机器学习导论》笔记和补充
- 基于神经网络的人脸识别(附代码)
-
Tree-ba
sed Convolutional Neural Networks - 《机器学习〔中文版〕》 PDF
- Neural Networks and DeepLearning - Michael Nie
- High-Dimensional Probability: An Introduction
- 神经模糊系统及其应用PDF电子书
- 图像分割算法研究区域分割,数学形
- 机器学习那些事
- 人工神经网络理论、设计及应用韩力
- cmac神经网络及在机械手逆解控制的应
- 卷积神经网络识别手写字体,很强大
- 神经网络导论实验报告
- 机器学习十大算法C实现
- 基于BP神经网络电力系统短期负荷预测
- Dence CRF 条件随机场图像分割
- BP神经网络用于两类图片识别分类
- 基于深度神经网络的用户会话推荐算
- 上海交通大学-张志华-机器学习/统计
- Introduction to Machine Learning Ethem ALPAYDI
评论
共有 条评论