Skip to content

fix: fix issue#221 #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions causallearn/score/LocalScoreFunction.py
Original file line number Diff line number Diff line change
@@ -206,7 +206,7 @@ def local_score_cv_general(
Thresh = 1e-5

if len(PAi):
PA = Data[:, PAi].reshape(-1, 1)
PA = Data[:, PAi]

# set the kernel for X
GX = np.multiply(X, X).reshape(-1, 1)
@@ -354,7 +354,7 @@ def local_score_cv_general(
CV = CV / k
else:
# set the kernel for X
GX = np.sum(np.multiply(X, X), axis=1)
GX = np.sum(np.multiply(X, X), axis=1).reshape(-1, 1)
Q = np.tile(GX, (1, T))
R = np.tile(GX.T, (T, 1))
dists = Q + R - 2 * X * X.T
@@ -416,8 +416,8 @@ def local_score_cv_general(
- 1
/ (gamma * n1)
* Kx_tr_te.T
* pdinv(np.eye(n1) + 1 / (gamma * n1) * Kx_tr)
* Kx_tr_te
@ pdinv(np.eye(n1) + 1 / (gamma * n1) * Kx_tr)
@ Kx_tr_te
) / gamma
B = 1 / (gamma * n1) * Kx_tr + np.eye(n1)
L = np.linalg.cholesky(B)
@@ -604,7 +604,7 @@ def local_score_cv_multi(
CV = CV / k
else:
# set the kernel for X
GX = np.sum(np.multiply(X, X), axis=1)
GX = np.sum(np.multiply(X, X), axis=1).reshape(-1, 1)
Q = np.tile(GX, (1, T))
R = np.tile(GX.T, (T, 1))
dists = Q + R - 2 * X * X.T

Unchanged files with check annotations Beta

# nlml is the returned value of the negative log marginal likelihood
# dnlml is a (column) vector of partial derivatives of the negative
# log marginal likelihood wrt each log hyperparameter
# mu is a (column) vector (of size nn) of prediced means

Check failure on line 462 in causallearn/utils/ScoreUtils.py

GitHub Actions / Check for spelling errors

prediced ==> predicted
# S2 is a (column) vector (of size nn) of predicted variances
#
# For more help on covariance functions, see "covFunctions".
common_neighbor = (X_child == 1) & (Y_child == 1)
if sum(common_neighbor) > 0: # have at least one common neighbor
indx = np.array([i for i in range(len(Y_child))])

Check failure on line 600 in causallearn/utils/PCUtils/Helper.py

GitHub Actions / Check for spelling errors

indx ==> index
common_neighbor_indx = indx[common_neighbor]

Check failure on line 601 in causallearn/utils/PCUtils/Helper.py

GitHub Actions / Check for spelling errors

indx ==> index
var = [X] + [Y] + list(condition_set)
prt_ls = get_prt_mvars(var, prt_m)
if len(list(set(common_neighbor_indx) & set(prt_ls))):
prt: list, parents of the missingness indicator r
"""
num_var = len(cg_skel_adj[0, :])
indx = np.array([i for i in range(num_var)])

Check failure on line 402 in causallearn/search/ConstraintBased/PC.py

GitHub Actions / Check for spelling errors

indx ==> index
prt = indx[cg_skel_adj[r, :] == 1]

Check failure on line 403 in causallearn/search/ConstraintBased/PC.py

GitHub Actions / Check for spelling errors

indx ==> index
return prt