資源簡介
gan代碼,可以用于深度學(xué)習(xí)的學(xué)習(xí),是很好用的代碼,現(xiàn)分享出來.
代碼片段和文件信息
clc
clear
%%?構(gòu)造真實(shí)訓(xùn)練樣本?60000個(gè)樣本?1*784維(28*28展開)
load?mnist_uint8;
train_x?=?double(train_x(1:60000:))?/?255;
%?真實(shí)樣本認(rèn)為為標(biāo)簽?[1?0];?生成樣本為[0?1];
train_y?=?double(ones(size(train_x1)1));
%?normalize
train_x?=?mapminmax(train_x?0?1);
rand(‘state‘0)
%%?構(gòu)造模擬訓(xùn)練樣本?60000個(gè)樣本?1*100維
test_x?=?normrnd(01[60000100]);?%?0-255的整數(shù)
test_x?=?mapminmax(test_x?0?1);
test_y?=?double(zeros(size(test_x1)1));
test_y_rel?=?double(ones(size(test_x1)1));
%%
nn_G_t?=?nnsetup([100?784]);
nn_G_t.activation_function?=?‘sigm‘;
nn_G_t.output?=?‘sigm‘;
nn_D?=?nnsetup([784?100?1]);
nn_D.weightPenaltyL2?=?1e-4;??%??L2?weight?decay
nn.dropoutFraction?=?0.5;???%??Dropout?fraction?
nn.learningRate?=?0.01;????????????????%??Sigm?require?a?lower?learning?rate
nn_D.activation_function?=?‘sigm‘;
nn_D.output?=?‘sigm‘;
%?nn_D.weightPenaltyL2?=?1e-4;??%??L2?weight?decay
nn_G?=?nnsetup([100?784?100?1]);
nn_D.weightPenaltyL2?=?1e-4;??%??L2?weight?decay
nn.dropoutFraction?=?0.5;???%??Dropout?fraction?
nn.learningRate?=?0.01;????????????????%??Sigm?require?a?lower?learning?rate
nn_G.activation_function?=?‘
評(píng)論
共有 條評(píng)論