Artificial Neural Networks for Beginners - MNIST Dataset: Unable to read file 'myWeights'. No such file or directory. Can anyone help me understand what I should do successfully load weights?

3 views (last 30 days)
Hopefully someone has successfully managed to follow the example and can point me in the right direction.
I have imported the data.
tr = csvread('train.csv', 1, 0); % read train.csv sub = csvread('test.csv', 1, 0); % read test.csv
Conducted data preparation.
Used the Neural Network Toolbox GUI API to create myNNfunc.m and myNNscript.m
I created VisualizingLearnedWeights.m. When I run this file I get an error message load myWeights % load the learned weights W1 =zeros(100, 28*28); % pre-allocation W1(:, x1_step1_keep) = IW1_1; % reconstruct the full matrix figure % plot images colormap(gray) % set to grayscale for i = 1:25 % preview first 25 samples subplot(5,5,i) % plot them in 6 x 6 grid digit = reshape(W1(i,:), [28,28])'; % row = 28 x 28 image imagesc(digit) % show the image end
the error message is: % Error using load % Unable to read file 'myWeights'. No such file or directory.
% Error in VisualizingLearnedWeights (line 7) % load myWeights % load the learned weights
In the workspace I can not see any weights. But I find W1. I have tried to search thru every script in order to find weights.

Answers (2)

Toshiaki Takeuchi
Toshiaki Takeuchi on 1 Sep 2015
You should remove "load myWeights" from your script. The blog post is like a cooking show, and it is just loading the pre-computed variables into memory. All it does is to load the following variables.
  • IW1_1
  • x1_step1_keep
They are defined within myNNfunc.m, as the blog post says.

Claire Reinhardt
Claire Reinhardt on 14 May 2016
Hi This my help VariableName = net.IW{1}

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!