Skip to content

Commit

Permalink
Removed TODO covering issue #44
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJas102 committed Mar 14, 2024
1 parent 244c8fb commit cca32cd
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/fit/NNLS_reg_CV.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@ def get_G(basis, H, identity, mu, signal, max_iter):
fit = NNLS_reg_fit(basis, H, mu, signal, max_iter)

# Calculating G with CrossValidation method
G = (norm(signal - np.matmul(basis, fit)) ** 2 /
np.trace(
identity - np.matmul(
np.matmul(
basis, np.linalg.inv(np.matmul(basis.T, basis) + np.matmul(mu * H.T, H)), ),
basis.T, )) ** 2
)
G = (
norm(signal - np.matmul(basis, fit)) ** 2
/ np.trace(
identity
- np.matmul(
np.matmul(
basis,
np.linalg.inv(np.matmul(basis.T, basis) + np.matmul(mu * H.T, H)),
),
basis.T,
)
)
** 2
)
return G


def NNLS_reg_CV(
basis: np.ndarray,
signal: np.ndarray,
tol: float,
max_iter: int,
basis: np.ndarray,
signal: np.ndarray,
tol: float,
max_iter: int,
):
"""
Regularised NNLS fitting with Cross validation to determine regularisation term.
Expand Down Expand Up @@ -104,7 +111,7 @@ def NNLS_reg_CV(
# NNLS fit of found minimum
mu = midpoint
fit_result = NNLS_reg_fit(basis, H, mu, signal, max_iter)
# TODO: Change fitting to standard NNLSregParams.fit function for consistency
# Change fitting to standard NNLSregParams.fit function for consistency
# _, results_test = Model.NNLS.fit(1, signal, basis, 200)

# Determine chi2_min
Expand Down

0 comments on commit cca32cd

Please sign in to comment.