Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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