Skip to content

Commit

Permalink
Merge pull request #81 from cesmix-mit/fix-sing-val-excep
Browse files Browse the repository at this point in the history
Use pseudoinverse in WLS to avoid singular value exception.
  • Loading branch information
emmanuellujan authored Jul 12, 2024
2 parents 32c23ff + 25cc387 commit 66b1242
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Learning/linear-learn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function learn!(

# Calculate coefficients β.
Q = Diagonal(ws[1] * ones(length(e_train)))
βs = (A'*Q*A) \ (A'*Q*b)
βs = pinv(A'*Q*A)*(A'*Q*b)

# Update lp.
if int
Expand Down Expand Up @@ -238,7 +238,7 @@ function learn!(
# Calculate coefficients βs.
Q = Diagonal([ws[1] * ones(length(e_train));
ws[2] * ones(length(f_train))])
βs = (A'*Q*A) \ (A'*Q*b)
βs = pinv(A'*Q*A)*(A'*Q*b)

# Update lp.
if int
Expand Down

0 comments on commit 66b1242

Please sign in to comment.