And TRSegmentOrthThingy

This commit is contained in:
Joakim Skogholt 2023-05-18 13:35:34 +02:00
parent 705154513f
commit e0d9a447df

View file

@ -121,7 +121,20 @@ TRObj = TRSVD(U, s, V, mX, regType, regParam1, regMat, n, p);
return TRObj
end
function TRSegmentOrth(X, segments)
n = size(X,1);
n_segments = maximum(segments);
U = zeros(n,n);
for seg in 1:n_segments
inds = vec(seg .== segments)
U[inds, inds], _, _ = svd(X[inds,:], full=false);
end
return U
end
"""
function TRVirCV(X, y, lambdas, regType="L2", regParam1=0, regParam2=1e-14)