Skip to content

Commit

Permalink
Docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Panchenko committed Feb 28, 2024
1 parent e4e5e5c commit f65d432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions src/sensai/data_transformation/dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,11 @@ def __init__(self,
transformation will be applied to each entry in the array.
:param fit: whether the rule's transformer shall be fitted. One use case for setting this to False is
if a transformer instance instead of a factory is given and the transformer is already fitted.
:param independent_columns: only relevant if the resulting rule matches multiple columns, in which case it is required.
If True, the columns are treated independent and a separate transformation is to be learned for each of them. Note that
this doesn't mean each column will get a separate transformer instance! Rather, the transformer will be fitted
on the array resulting from selecting the matched columns.
If False, all matching columns are treated as a single feature for the purpose of normalisation.
Thus, all columns will be concatenated before fitting the transformer.
:param independent_columns: whether, for the case where the rule matches multiple columns, the columns are independent and a
separate transformation is to be learned for each of them (rather than using the same transformation for all columns and
learning the transformation from the data of all columns).
This parameter must be specified to for rules matching more than one column,
None is acceptable for rules mathching a single column, in which case None, True, and False all have the same effect.
"""
# NOTE: keep in sync with Rule!
if (skip or unsupported) and count_not_none(transformer, transformer_factory) > 0:
Expand Down Expand Up @@ -633,12 +632,11 @@ def __init__(self,
transformation will be applied to each entry in the array.
:param fit: whether the rule's transformer shall be fitted. One use case for setting this to False is
if a transformer instance instead of a factory is given and the transformer is already fitted.
:param independent_columns: only relevant if the resulting rule matches multiple columns, in which case it is required.
If True, the columns are treated independent and a separate transformation is to be learned for each of them. Note that
this doesn't mean each column will get a separate transformer instance! Rather, the transformer will be fitted
on the array resulting from selecting the matched columns.
If False, all matching columns are treated as a single feature for the purpose of normalisation.
Thus, all columns will be concatenated before fitting the transformer.
:param independent_columns: whether, for the case where the rule matches multiple columns, the columns are independent and a
separate transformation is to be learned for each of them (rather than using the same transformation for all columns and
learning the transformation from the data of all columns).
This parameter must be specified to for rules matching more than one column,
None is acceptable for rules mathching a single column, in which case None, True, and False all have the same effect.
"""
if (skip or unsupported) and count_not_none(transformer, transformer_factory) > 0:
raise ValueError("Passed transformer or transformer_factory while skip=True or unsupported=True")
Expand Down
2 changes: 1 addition & 1 deletion src/sensai/featuregen/feature_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self,
add_categorical_default_rules: bool = True):
"""
:param categorical_feature_names: either a sequence of column names or a regex that is to match all categorical feature names
(which must not only work for the feature generated by this feature generator, i.e., it should not match feature names generated
(which must not only work for the feature generated by this feature generator, i.e. it should not match feature names generated
by other feature generators).
It will be ensured that the respective columns in the generated data frames will have dtype 'category'.
Furthermore, the presence of meta-information can later be leveraged for further transformations, e.g., one-hot encoding.
Expand Down

0 comments on commit f65d432

Please sign in to comment.