How to use the retentioneering.core.feature_extraction function in retentioneering

To help you get started, we’ve selected a few retentioneering 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 retentioneering / retentioneering-tools / retentioneering / core / utils.py View on Github external
if feature_type not in self._embedding_types:
            raise ValueError("Unknown feature type: {}.\nPlease choose one from {}".format(
                feature_type,
                ' '.join(self._embedding_types)
            ))

        func = getattr(feature_extraction, feature_type + '_embedder')
        if drop_targets:
            tmp = self._obj[
                ~self._obj[self._event_col()].isin(self.retention_config['target_event_list'])
            ].copy()
        else:
            tmp = self._obj
        res = func(tmp, **kwargs)
        if metadata is not None:
            res = feature_extraction.merge_features(res, metadata, **kwargs)
        return res
github retentioneering / retentioneering-tools / retentioneering / core / utils.py View on Github external
Returns
        -------
        Encoded user trajectories

        Return type
        -------
        pd.DataFrame of (number of users, number of unique events | event n-grams)
        """
        self._init_cols(locals())
        if feature_type not in self._embedding_types:
            raise ValueError("Unknown feature type: {}.\nPlease choose one from {}".format(
                feature_type,
                ' '.join(self._embedding_types)
            ))

        func = getattr(feature_extraction, feature_type + '_embedder')
        if drop_targets:
            tmp = self._obj[
                ~self._obj[self._event_col()].isin(self.retention_config['target_event_list'])
            ].copy()
        else:
            tmp = self._obj
        res = func(tmp, **kwargs)
        if metadata is not None:
            res = feature_extraction.merge_features(res, metadata, **kwargs)
        return res