資源簡介
gan代碼,可以用于深度學習的學習,是很好用的代碼,現分享出來.
代碼片段和文件信息
clc
clear
%%?構造真實訓練樣本?60000個樣本?1*784維(28*28展開)
load?mnist_uint8;
train_x?=?double(train_x(1:60000:))?/?255;
%?真實樣本認為為標簽?[1?0];?生成樣本為[0?1];
train_y?=?double(ones(size(train_x1)1));
%?normalize
train_x?=?mapminmax(train_x?0?1);
rand(‘state‘0)
%%?構造模擬訓練樣本?60000個樣本?1*100維
test_x?=?normrnd(01[60000100]);?%?0-255的整數
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?=?‘
評論
共有 條評論