INNER CODE UNIT · Python

Bnorm

XMU-Kuangnan-Fang-Team/GENetLib · GENetLib/BsplineFunc.py:268

                Bnorm = np.sqrt(np.sum(np.diag(Bmat0.T @ Bmat0)))
                pennorm = np.sqrt(np.sum(penmat * penmat))
                condno = pennorm / Bnorm
                if lambda_ * condno > 1e12:
                    lambda_ = 1e12 / condno
                    print(
                        f"Warning: lambda reduced to {lambda_} to prevent overflow"
                    )
                if covariates is not None:
                    penmat = np.block(
                        [
                            [penmat, np.zeros((nbasis, q))],
                            [np.zeros((q, nbasis)), np.zeros((q, q))],
                        ]
                    )
                Bmat = Bmat0 + lambda_ * penmat
            else:
                penmat = None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…