Skip to content

Commit 55da344

Browse files
committed
Uploaded estimated models
1 parent 053cb0b commit 55da344

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

Data/Models/PLS1_hat.mat

5.38 MB
Binary file not shown.

Data/Models/PLS2_hat.mat

5.87 MB
Binary file not shown.

Scripts/Models_building.m

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
clc
2+
clearvars
3+
warning off
4+
5+
%% Data import
6+
7+
data = readtable("..\Data\Sources\stell-faults.csv");
8+
faultClasses = data.Properties.VariableNames;
9+
faultClasses = faultClasses(28:end);
10+
rowLimits = [158 348 739 811 866 1268 size(data, 1)];
11+
colLimits = 28:size(data, 2);
12+
13+
%% Models estimation and validation
14+
15+
numIter = 50;
16+
testPercent = .30;
17+
18+
% PLS2
19+
for nVar = 2:length(faultClasses)
20+
subset = data(1:rowLimits(nVar), 1:colLimits(nVar));
21+
X = subset{1:rowLimits(nVar), 1:28};
22+
Y = subset{1:rowLimits(nVar), faultClasses(1:nVar)};
23+
model = PLS(X, Y, "Algorithm", "PLS2", "Trace", "on");
24+
model = model.orderAnalysis(numIter, "Trace", "on");
25+
model = model.estimate(model.orderRed.bestAlpha);
26+
model = model.predict;
27+
model = model.validate(testPercent, "Repeatable", "true");
28+
model = model.crossval("Repeatable", "true");
29+
models_PLS2.("p" + nVar) = model;
30+
end
31+
save("..\Data\Models\PLS2_hat", "models_PLS2");
32+
33+
% PLS1
34+
for nVar = 2:length(faultClasses)
35+
subset = data(1:rowLimits(nVar), 1:colLimits(nVar));
36+
X = subset{1:rowLimits(nVar), 1:28};
37+
Y = subset{1:rowLimits(nVar), faultClasses(1:nVar)};
38+
model = PLS(X, Y, "Algorithm", "PLS1", "Trace", "on");
39+
model = model.orderAnalysis(numIter, "Trace", "on");
40+
model = model.estimate(model.orderRed.bestAlpha);
41+
model = model.predict;
42+
model = model.validate(testPercent, "Repeatable", "true");
43+
model = model.crossval("Repeatable", "true");
44+
models_PLS1.("p" + nVar) = model;
45+
end
46+
save("..\Data\Models\PLS1_hat", "models_PLS1");

0 commit comments

Comments
 (0)