Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-Bachman committed Jan 10, 2013
1 parent 3d8f023 commit 133c593
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 0 additions & 5 deletions SimpleNet.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,6 @@
for e=1:params.epochs,
idx = randsample(all_idx, batch_size, false);
Xtr = X(idx,:);
if (1 == 1)
noise_scales = 0.05 * std(Xtr);
noise = bsxfun(@times, randn(size(Xtr)), noise_scales);
Xtr = Xtr + noise;
end
Ytr = Y(idx,:);
for r=1:params.batch_rounds,
% Run backprop to compute gradients for this training batch
Expand Down
20 changes: 11 additions & 9 deletions test_mnist.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
% Load and "preprocess" MNIST digit data %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load('mnist_data.mat');
X = X_mnist;
Y = Y_mnist;
X = X((Y < 5),:);
Y = Y((Y < 5),:);
idx = randsample(size(X_mnist,1),30000);
X = X_mnist(idx,:);
Y = Y_mnist(idx,:);
% X = X((Y < 5),:);
% Y = Y((Y < 5),:);
X = ZMUV(double(X));
Y_vals = unique(Y);
Ym = zeros(size(X,1),numel(Y_vals));
Expand All @@ -23,7 +24,7 @@
obs_dim = size(X,2);
out_dim = size(Y,2);
obs_count = size(X,1);
train_count = round(obs_count * 0.75);
train_count = round(obs_count * 0.8);

% Split data into training and testing portions
tr_idx = randsample(obs_count,train_count,false);
Expand All @@ -38,22 +39,23 @@
act_func = ActFunc(2);
out_func = ActFunc(1);
loss_func = LossFunc(3);
layer_sizes = [obs_dim 2*obs_dim 2*obs_dim out_dim];
layer_sizes = [obs_dim 1500 1500 out_dim];

% Generate a SimpleNet instance
net = SimpleNet(layer_sizes, act_func, out_func, loss_func);
net.init_weights(0.1);
net.drop_stride = 5;

% Set up parameter struct for updates
params = struct();
params.epochs = 1000;
params.epochs = 10000;
params.start_rate = 1.0;
params.decay_rate = 0.1^(1 / params.epochs);
params.momentum = 0.5;
params.weight_bound = 10;
params.weight_bound = 20;
params.batch_size = 100;
params.batch_rounds = 1;
params.dr_obs = 0.0;
params.dr_obs = 0.1;
params.dr_node = 0.5;
params.do_validate = 1;
params.X_v = X_te;
Expand Down

0 comments on commit 133c593

Please sign in to comment.