Skip to content

Commit

Permalink
use the simple svd approach for the degree of freedom
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengp0 committed Feb 15, 2024
1 parent 16f73a7 commit e651f00
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/limetr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,9 @@ def get_degree_of_freedom(model: LimeTr):
if c_mat_active.size == 0:
return k

lb, ub = c_mat_active.min(axis=0), c_mat_active.max(axis=0)
lb[np.isclose(lb, 0.0)] = 0.0
ub[np.isclose(ub, 0.0)] = 0.0
_, s, _ = np.linalg.svd(c_mat_active)

return k - 0.5 * ((lb < 0) + (ub > 0)).sum()
return k - (s / s.max()).sum()


def get_aic(model: LimeTr):
Expand Down

0 comments on commit e651f00

Please sign in to comment.