Commit 474554ac authored by hazrmard's avatar hazrmard
Browse files

committing changes for repo relocation

parent 133fc0aa
Loading
Loading
Loading
Loading

..git.un~

0 → 100644
+647 B

File added.

No diff preview for this file type.

+4 −1
Original line number Diff line number Diff line
@@ -4,3 +4,6 @@
*.asv
*.mat
slprj
__pycache__
.ipynb_checkpoints
.vscode
 No newline at end of file

.git~

0 → 100644
+1 −0
Original line number Diff line number Diff line
gitdir: C:/Users/ahmedi/Developer/bare_repos/.datadrivenmodels
+14 −0
Original line number Diff line number Diff line
{
	"folders": [
		{
			"path": "."
		},
		{
			"path": "..\\pyTorchBridge"
		},
		{
			"path": "..\\pyStateSpace"
		}
	],
	"settings": {}
}
 No newline at end of file

dummyLSTMone.m

deleted100644 → 0
+0 −56
Original line number Diff line number Diff line
% Training an LSTM network to predict the next number
% from an input sequence.
% 
% Input:  1,2,3
% Output: 4 
N = 1000;
NTest = 200;
seqLen = 10;

seq = reshape([1:N], seqLen, [])';
testSeq = reshape([N+1:N+NTest], seqLen, [])';

% The input variables are normalized to have 0 mean
% and 1 variance.
mu = mean(seq(:));
sig = std(seq(:));
stdSeq = (seq - mu) / sig;
stdTest = (testSeq - mu) / sig;

% Preparing input data as a cell array of row vectors.
XTrain = mat2cell(stdSeq(1:end-1,:),...
                  ones(1, N/seqLen - 1));
XTest = mat2cell(stdTest(1:end-1,:),...
                  ones(1, NTest/seqLen - 1));

% For format of the response, see
% https://www.mathworks.com/help/deeplearning/ref/trainnetwork.html
% The labels are a matrix of the next number for each
% training sequence.
YTrain = seq(2:end,1);
YTest = testSeq(2:end,1);

% Defining an LSTM network. An LSTM layer takes as
% input `numHiddenUnits` which is the number of time
% steps that an LSTM cell "memorizes" i.e. the window
% over which the LSTM layer operates.
layers = [...
    sequenceInputLayer(1)
    lstmLayer(10,'OutputMode','last')
    fullyConnectedLayer(1)
    regressionLayer];

options = trainingOptions('adam', ...
    'MaxEpochs',150, ...
    'MiniBatchSize', 5, ...
    'GradientThreshold',1, ...
    'InitialLearnRate',1.0, ...
    'LearnRateSchedule','piecewise', ...
    'LearnRateDropPeriod', 20, ...
    'LearnRateDropFactor',0.5, ...
    'Verbose',0, ...
    'Plots','training-progress');

net = trainNetwork(XTrain, YTrain, layers, options);

YPred = int32(predict(net, XTrain));
 No newline at end of file
Loading