commit message
This commit is contained in:
parent
24b0117d48
commit
f7350649be
3 changed files with 20 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
name = "MinPakke"
|
name = "MinPakke"
|
||||||
uuid = "be803360-cecc-4859-8120-03d0223bb960"
|
uuid = "be803360-cecc-4859-8120-03d0223bb960"
|
||||||
authors = ["Joakim"]
|
authors = ["Joakim"]
|
||||||
version = "1.0.1-DEV"
|
version = "1.0.2-DEV"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
|
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export createDataSplitBinaryStratified
|
||||||
export importData
|
export importData
|
||||||
export calculateRMSE
|
export calculateRMSE
|
||||||
export predRegression
|
export predRegression
|
||||||
|
export modelSelectionStatistics
|
||||||
|
|
||||||
export PCR
|
export PCR
|
||||||
export bidiag2
|
export bidiag2
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,26 @@ XVal = my_split["XVal"];
|
||||||
using Random
|
using Random
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
function modelSelectionStatistics(results)
|
||||||
|
|
||||||
|
Takes as input the rmse output from calculateRMSE and returns
|
||||||
|
the number of components minimising the validation error
|
||||||
|
together with the test set results.
|
||||||
|
"""
|
||||||
|
function modelSelectionStatistics(results)
|
||||||
|
|
||||||
|
n_iter = size(results, 3);
|
||||||
|
results_sel = zeros(n_iter);
|
||||||
|
n_comps = convert(Vector{Int64}, zeros(n_iter));
|
||||||
|
|
||||||
|
for i=1:n_iter
|
||||||
|
_, n_comps[i] = findmin(results[2,:,i]);
|
||||||
|
results_sel[i] = results[3, n_comps[i], i];
|
||||||
|
end
|
||||||
|
|
||||||
|
return results_sel, n_comps
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue