1 Star 0 Fork 0

zhoub86/ViterbiNet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
TrainViterbiNet.m 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
nirhlezinger1 提交于 2019-10-28 11:38 . Add files via upload
function net = TrainViterbiNet(m_fXtrain,v_fYtrain ,s_nConst, layers, learnRate)
% Train ViterbiNet conditional distribution network
%
% Syntax
% -------------------------------------------------------
% net = TrainViterbiNet(m_fXtrain,v_fYtrain ,s_nConst, layers, learnRate)
%
% INPUT:
% -------------------------------------------------------
% m_fXtrain - training symobls corresponding to each channel output (memory x training size matrix)
% v_fYtrain - training channel outputs (vector with training size entries)
% s_nConst - constellation size (positive integer)
% layers - neural network model to train / re-train
% learnRate - learning rate (poitive scalar, 0 for default of 0.01)
%
%
% OUTPUT:
% -------------------------------------------------------
% net - trained neural network model
s_nM = size(m_fXtrain,1);
% Combine each set of inputs as a single unique category
v_fCombineVec = s_nConst.^(0:s_nM-1);
% format training to comply with Matlab's deep learning toolbox settings
v_fXcat = categorical((v_fCombineVec*(m_fXtrain-1))');
v_fYcat = num2cell(v_fYtrain');
if (learnRate == 0)
learnRate = 0.01;
end
% Network parameters
maxEpochs = 100;
miniBatchSize = 27;
options = trainingOptions('adam', ...
'ExecutionEnvironment','cpu', ...
'InitialLearnRate', learnRate, ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'GradientThreshold',1, ...
'Verbose',false ...
);%,'Plots','training-progress'); % This can be unmasked to display training convergence
% Train netowrk
net = trainNetwork(v_fYcat,v_fXcat,layers,options);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhoub86/ViterbiNet.git
git@gitee.com:zhoub86/ViterbiNet.git
zhoub86
ViterbiNet
ViterbiNet
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385