資源簡介
Softmax 函數處理,softmax 用于 Deep Learning 后的分類器的實現與識別,此函數的參數經過優化,有較強的泛化能力和性能
代碼片段和文件信息
function?[cost?grad]?=?softmaxCost(theta?numClasses?inputSize?lambda?data?labels)
%?numClasses?-?the?number?of?classes?
%?inputSize?-?the?size?N?of?the?input?vector
%?lambda?-?weight?decay?parameter
%?data?-?the?N?x?M?input?matrix?where?each?column?data(:?i)?corresponds?to
%????????a?single?test?set
%?labels?-?an?M?x?1?matrix?containing?the?labels?corresponding?for?the?input?data
%
%?Unroll?the?parameters?from?theta
theta?=?reshape(theta?numClasses?inputSize);
numCases?=?size(data?2);
groundTruth?=?full(sparse(labels?1:numCases?1));
cost?=?0;
thetagrad?=?zeros(numClasses?inputSize);
%%?----------?YOUR?CODE?HERE?--------------------------------------
%??Instructions:?Compute?the?cost?and?gradient?for?softmax?regression.
%????????????????You?need?to?compute?thetagrad?and?cost.
%????????????????The?groundTruth?matrix?might?come?in?handy.
%?------------------------------------------------------------------
%?Unroll?the?gradient?matrices?into?a?vector?for?minFunc
grad?=?[thetagrad(:)];
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1033??2020-11-28?12:27??softmaxCost.m
?????文件????????4775??2020-11-28?12:27??softmaxExercise.m
?????文件?????????713??2020-11-28?12:27??softmaxPredict.m
?????文件????????1891??2020-11-28?12:27??softmaxTrain.m
- 上一篇:ssa奇異譜分析
- 下一篇:Series Forcast 用于時間序列的預測
評論
共有 條評論