Skip to content

Commit

Permalink
Return early.
Browse files Browse the repository at this point in the history
  • Loading branch information
kklein committed Feb 5, 2025
1 parent 5b3a419 commit 2a78f0a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions metalearners/metalearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,12 @@ def _combine_propensity_and_nuisance_specs(

def _filter_x_columns(X: Matrix, feature_set: Features) -> Matrix:
if feature_set is None:
X_filtered = X
elif len(feature_set) == 0:
X_filtered = np.ones((safe_len(X), 1))
else:
if isinstance(X, pd.DataFrame):
X_filtered = X[list(feature_set)]
else:
X_filtered = X[:, np.array(feature_set)]
return X_filtered
return X
if len(feature_set) == 0:
return np.ones((safe_len(X), 1))
if isinstance(X, pd.DataFrame):
return X[list(feature_set)]
return X[:, np.array(feature_set)]


def _validate_n_folds_synchronize(n_folds: dict[str, int]) -> None:
Expand Down

0 comments on commit 2a78f0a

Please sign in to comment.