How to use the mlprimitives.adapters.featuretools.calculate_feature_matrix function in mlprimitives

To help you get started, we’ve selected a few mlprimitives 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 HDI-Project / MLPrimitives / mlprimitives / adapters / featuretools.py View on Github external
instance_ids = X[self.index]
        else:
            instance_ids = X.index.values

        self.features = ft.dfs(
            cutoff_time=cutoff_time,
            instance_ids=instance_ids,
            max_depth=self.max_depth,
            entityset=entityset,
            target_entity=target_entity,
            features_only=True,
            agg_primitives=self.agg_primitives,
            trans_primitives=self.trans_primitives
        )

        X = ft.calculate_feature_matrix(
            self.features,
            entityset=entityset,
            cutoff_time=cutoff_time,
            instance_ids=instance_ids,
        )

        if self.encode:
            X, self.features = ft.encode_features(X, self.features)

        if self.remove_low_information:
            X, self.features = remove_low_information_features(X, self.features)
github HDI-Project / MLPrimitives / mlprimitives / adapters / featuretools.py View on Github external
def calculate_feature_matrix(self, X, target_entity=None, entityset=None,
                                 entities=None, relationships=None):

        if entityset is None:
            entityset = self._get_entityset(X, target_entity, entities, relationships)

        instance_ids = None
        cutoff_time = None
        if self.time_index:
            cutoff_time = X[[self.index, self.time_index]]
        elif self.index:
            instance_ids = X[self.index]
        else:
            instance_ids = X.index.values

        X = ft.calculate_feature_matrix(
            self.features,
            entityset=entityset,
            cutoff_time=cutoff_time,
            instance_ids=instance_ids,
        )

        return X