I want to drive the four corners of the US, LA>Seattle>Boston>Miami, in a 12 cylinder grand tourer.
Sequence Training for Neural Networks in Matlab
I had 77 pairs of sequences and sequence responses in Matlab. I had two cell arrays, sequences and responses, of dimension 77×1. Each cell held a 10×10,000 array. I created options, layers, and hyperparamaters, and executed
[net, info] = trainNetwork(sequences, responses, layers, options);
The network trained. Things worked.
I got more data, hundreds of pairs. I could still train the network, but I was rapidily coming to the memory limit on my HPC. I wanted to use datastores.
S(cripts) 1
save(‘sequences.mat’,’sequences’);
save(‘responses.mat’,’responses’);
S2
AData = fileDatastore(‘sequences.mat’,’Readfcn’,’@load’);
BData = fileDatastore(‘responses.mat’,’Readfcn’,’@load’);
CData = combine(AData, BData);
… %stuff
[net, info] = trainNetwork(CData, layers, options);
Error using trainNetwork (line 184)
Invalid training data. Predictors must be a N-by-1 cell array of sequences, where N is the number of sequences. All sequences
must have the same feature dimension and at least one time step.
Error in S1 (line ##)
[net, info] = trainNetwork(CData, layers, options);
Or in English, it did not work.
Using preview, I got this:
ans =
1×2 cell array
{1×1 struct} {1×1 struct}
First, the load function creatues a struct. I needed a de-struct-ing function.
Now, I got this.
preview(CData)
ans =
1×2 cell array
{259×1 cell} {259×1 cell}
Second, the combine function creats another cell array, meaning I had a 1×2 cell array (CData), each cell holding a 200×1 cell array (AData and BData), but those were holding lesser datastores.
The solution to the latter was saving each cell as an individual file with one vairable per file, that variable being the 10×10,000 array, NOT A CELL.
S3
%file manip, mkdir, addpath, etc.
for n=1:length(sequences)
sequence1 = sequences{n,1};
response1 = responses{n,1};
save(strcat(‘sequences’,string(n),’,mat’),’sequence1′);
save(strcat(‘responses’,string(n),’,mat’),’sequence1′);
end
AND THEN running S4
%file manip, preprocessing, etc.
getVarFromStruct = @(strct,varName) strct.(varName);
xds = fileDatastore(“sequences*.mat”,”ReadFcn”,@(fname) getVarFromStruct(load(fname),”sequence1″),”FileExtensions”,”.mat”);
yds = fileDatastore(“responses*.mat”,”ReadFcn”,@(fname) getVarFromStruct(load(fname),”response1″),”FileExtensions”,”.mat”);
%options, layers, hp, etc.
[net, info] = trainNetwork(CData, layers, options);
And it worked.
In the preview of CData up there, it creates 2 cell arrays OF CELLS. TrainNetwork doesn’t want cells; it wants data. So the extra layer of cells caused all those errors.
That took me weeks, and someone else had to explain it.
Little moves
Stay calm, stay focused, get things done
PM Shinzo Abe
My deepest condolences and respect to the Japanese people in the wake of Abe’s assassination.
Elon Musk is in the news
And I unsubscribed from Matt Levine.
.
Pencil sharpeners are nice.
The grindy type are better than the blade type. The bladed ones tend to shred the wooden sidewalls, but a good grindy sharpener doesn’t.
Control Data
I’ve been using the logistics map as my control data. Picking the right starting conditions, it never converges to anything.
Perspective
I used to think my undergrads threw temper tantrums.
I recently told a 5yo she couldn’t have the toy she wanted.
I apologize to my undergrads.
What Not To Do: Sales
The post was a link to someone selling something. The seller not being welcoming.
However I learned that posts like mine can lead to brigading or other such nasty behavoir. I do not want to do that. My mistake, shouldn’t a’ made the post, etc.
Kid Fights
Kids feel the same way about people stealing their seats at lunch as adult drivers do when someone cuts line merging.