Skip to content

Commit ad7c608

Browse files
committed
Fix bug: X_A when prepare input
1 parent 4d66859 commit ad7c608

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

causarray/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ def prep_causarray_data(Y, A, X=None, X_A=None, intercept=True):
5050
if not isinstance(A, pd.DataFrame):
5151
A = np.asarray(A)
5252

53-
X = np.zeros((Y.shape[0], 0)) if X is None else np.asarray(X)
54-
intercept_col = np.ones((X.shape[0], 1)) if intercept else np.empty((X.shape[0], 0))
55-
X = np.hstack((intercept_col, X))
56-
53+
X = np.zeros((Y.shape[0], 0)) if X is None else np.asarray(X)
5754
X_A = X if X_A is None else np.asarray(X_A)
5855
loglibsize = np.log2(np.sum(np.asarray(Y), axis=1))
5956
loglibsize = (loglibsize - np.mean(loglibsize)) / np.std(loglibsize, ddof=1)
6057
X_A = np.hstack((X_A, loglibsize[:, None]))
6158

59+
intercept_col = np.ones((X.shape[0], 1)) if intercept else np.empty((X.shape[0], 0))
60+
X = np.hstack((intercept_col, X))
61+
X_A = np.hstack((intercept_col, X_A))
62+
6263
return Y, A, X, X_A
6364

6465

0 commit comments

Comments
 (0)