Total Complexity | 1 |
Total Lines | 13 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Defines functions that will serve as engine commands with an arbitrary object as receiver. |
||
2 | These commands should be "built" using a suitable function/decorator. |
||
3 | At runtime, their (command) arguments are the same as the function holding the business logic. |
||
4 | """ |
||
5 | from so_magic.data.features.phis import ListOfCategoricalPhi, DatapointsAttributePhi |
||
6 | |||
7 | |||
8 | # at runtime it will expect only the 'datapoints', 'attribute' and 'new_attribute' arguments |
||
9 | def encode_nominal_subsets_command(datapoints, attribute, new_attribute): |
||
10 | phi = ListOfCategoricalPhi(DatapointsAttributePhi(datapoints)) |
||
11 | new_values = phi(attribute) |
||
12 | datapoints.mutator.add_column(datapoints, new_values, new_attribute) |
||
13 |