Skip to content

Commit c16c69f

Browse files
authored
Merge pull request #226 from IvanArkhipov1999/fix-typos
Fix typoes
2 parents cdf01cf + aff6af7 commit c16c69f

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

causallearn/search/ConstraintBased/PC.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ def get_parent(r: int, cg_skel_adj: ndarray) -> ndarray:
399399
prt: list, parents of the missingness indicator r
400400
"""
401401
num_var = len(cg_skel_adj[0, :])
402-
indx = np.array([i for i in range(num_var)])
403-
prt = indx[cg_skel_adj[r, :] == 1]
402+
index = np.array([i for i in range(num_var)])
403+
prt = index[cg_skel_adj[r, :] == 1]
404404
return prt
405405

406406

causallearn/utils/PCUtils/Helper.py

+34-34
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,9 @@ def get_predictor_ws(mdata, num_test_var, effective_sz):
547547
np.random.shuffle(arr)
548548

549549
## 3. effective sample size
550-
indx_W_shuffle = arr[:effective_sz]
550+
index_W_shuffle = arr[:effective_sz]
551551

552-
W_del_shuffle_eff = Ws_del[indx_W_shuffle, :] # the sample size of W should be equal to effective sample size
552+
W_del_shuffle_eff = Ws_del[index_W_shuffle, :] # the sample size of W should be equal to effective sample size
553553
return W_del_shuffle_eff.reshape(-1, Ws_ncol)
554554

555555

@@ -597,11 +597,11 @@ def contain_common_neighbors_prt_mvar(X, Y, condition_set, skel, prt_m):
597597

598598
common_neighbor = (X_child == 1) & (Y_child == 1)
599599
if sum(common_neighbor) > 0: # have at least one common neighbor
600-
indx = np.array([i for i in range(len(Y_child))])
601-
common_neighbor_indx = indx[common_neighbor]
600+
index = np.array([i for i in range(len(Y_child))])
601+
common_neighbor_index = index[common_neighbor]
602602
var = [X] + [Y] + list(condition_set)
603603
prt_ls = get_prt_mvars(var, prt_m)
604-
if len(list(set(common_neighbor_indx) & set(prt_ls))):
604+
if len(list(set(common_neighbor_index) & set(prt_ls))):
605605
# at least one common neighbor is the parent of M
606606
return True
607607
else: # the common neighbors are not the parent of M
@@ -615,14 +615,14 @@ def get_prt_mvars(var, prt_m):
615615
:params:
616616
- var: a list or a tuple
617617
:return:
618-
- W_indx_: a list with unique elements
618+
- W_index_: a list with unique elements
619619
"""
620-
W_indx_ = []
620+
W_index_ = []
621621
for vi in var:
622622
if vi in prt_m['m']: # vi has a missingness indicator requiring correction
623-
W_indx_ += get_prt_of_mi(vi, prt_m)
624-
W_indx_ = list(np.unique(W_indx_))
625-
return W_indx_
623+
W_index_ += get_prt_of_mi(vi, prt_m)
624+
W_index_ = list(np.unique(W_index_))
625+
return W_index_
626626

627627

628628
def get_prt_of_mi(vi, prt_m):
@@ -633,30 +633,30 @@ def get_prt_of_mi(vi, prt_m):
633633
return list(prti)
634634

635635

636-
def get_prt_mw(W_indx_, prt_m):
636+
def get_prt_mw(W_index_, prt_m):
637637
"""Iteratively get the parents of missingness indicators of W
638638
:params:
639-
W_indx_: a list with unique elements
639+
W_index_: a list with unique elements
640640
:return:
641-
W_indx: a list with unique elements
641+
W_index: a list with unique elements
642642
"""
643-
W_indx = W_indx_
644-
prt_W = get_prt_mvars(W_indx, prt_m)
645-
stop_cond = list(set(prt_W) - set(W_indx))
646-
while len(stop_cond) > 0: # There are parents of W_indx
647-
W_indx += prt_W
648-
W_indx = list(np.unique(W_indx))
649-
prt_W = get_prt_mvars(W_indx, prt_m)
650-
stop_cond = list(set(prt_W) - set(W_indx))
643+
W_index = W_index_
644+
prt_W = get_prt_mvars(W_index, prt_m)
645+
stop_cond = list(set(prt_W) - set(W_index))
646+
while len(stop_cond) > 0: # There are parents of W_index
647+
W_index += prt_W
648+
W_index = list(np.unique(W_index))
649+
prt_W = get_prt_mvars(W_index, prt_m)
650+
stop_cond = list(set(prt_W) - set(W_index))
651651

652-
# No more parents of W_indx outside of the list W_indx
653-
return list(np.unique(W_indx))
652+
# No more parents of W_index outside of the list W_index
653+
return list(np.unique(W_index))
654654

655655

656656
def test_wise_deletion(data):
657657
"""dataset after test-wise deletion"""
658-
indxCompleteRows = get_indx_complete_rows(data)
659-
return data[indxCompleteRows, :]
658+
indexCompleteRows = get_index_complete_rows(data)
659+
return data[indexCompleteRows, :]
660660

661661

662662
def learn_regression_model(tdel_data, num_model):
@@ -699,13 +699,13 @@ def get_sub_correlation_matrix(mvdata):
699699
matrix: the correlation matrix of all the variables
700700
sample_size: the sample size of the dataset after test-wise deletion
701701
"""
702-
indxRows = get_indx_complete_rows(mvdata)
703-
matrix = np.corrcoef(mvdata[indxRows, :], rowvar=False)
704-
sample_size = len(indxRows)
702+
indexRows = get_index_complete_rows(mvdata)
703+
matrix = np.corrcoef(mvdata[indexRows, :], rowvar=False)
704+
sample_size = len(indexRows)
705705
return matrix, sample_size
706706

707707

708-
def get_indx_complete_rows(mvdata):
708+
def get_index_complete_rows(mvdata):
709709
"""
710710
Get the index of the rows with complete records
711711
-------
@@ -718,9 +718,9 @@ def get_indx_complete_rows(mvdata):
718718
the index of the rows with complete records
719719
"""
720720
nrow, ncol = np.shape(mvdata)
721-
bindxRows = np.ones((nrow,), dtype=bool)
722-
indxRows = np.array(list(range(nrow)))
721+
bindexRows = np.ones((nrow,), dtype=bool)
722+
indexRows = np.array(list(range(nrow)))
723723
for i in range(ncol):
724-
bindxRows = np.logical_and(bindxRows, ~np.isnan(mvdata[:, i]))
725-
indxRows = indxRows[bindxRows]
726-
return indxRows
724+
bindexRows = np.logical_and(bindexRows, ~np.isnan(mvdata[:, i]))
725+
indexRows = indexRows[bindexRows]
726+
return indexRows

causallearn/utils/ScoreUtils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def gpr_multi_new(logtheta=None, covfunc=None, x=None, y=None, xstar=None, nargo
459459
# nlml is the returned value of the negative log marginal likelihood
460460
# dnlml is a (column) vector of partial derivatives of the negative
461461
# log marginal likelihood wrt each log hyperparameter
462-
# mu is a (column) vector (of size nn) of prediced means
462+
# mu is a (column) vector (of size nn) of predicted means
463463
# S2 is a (column) vector (of size nn) of predicted variances
464464
#
465465
# For more help on covariance functions, see "covFunctions".

0 commit comments

Comments
 (0)