How to use the causallib.utils.stat_utils.which_columns_are_binary function in causallib

To help you get started, we’ve selected a few causallib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / causallib / causallib / preprocessing / transformers.py View on Github external
def _get_relevant_features(X):
        """
        Returns a binary mask specifying the continuous features to operate on.

        Args:
            X (pd.DataFrame): array-like, shape [n_samples, n_features] The data used to compute the mean and standard
                              deviation used for later scaling along the features axis (axis=0).

        Returns:
            pd.Index: a pd.Index with name of columns specifying which features to apply the transformation on.
        """
        # FIXME utilize sklearn.utils.multiclass.type_of_target()
        continuous_cols = X.columns[~which_columns_are_binary(X)]
        return continuous_cols
github IBM / causallib / causallib / preprocessing / transformers.py View on Github external
def _get_relevant_features(self, X):
        """
        Returns a binary mask specifying the features to operate on (either all features or binary features if
        self.only_binary_features is True.

        Args:
            X (pd.DataFrame): array-like, shape [n_samples, n_features] The data used to compute the mean and standard
                            deviation used for later scaling along the features axis (axis=0).

        Returns:
            pd.Index: a binary mask specifying which features to apply the transformation on.
        """
        if self.only_binary_features:
            feature_mask = which_columns_are_binary(X)
        else:
            feature_mask = np.ones(X.shape[1], dtype=bool)
        return feature_mask

causallib

A Python package for flexible and modular causal inference modeling

Apache-2.0
Latest version published 9 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages