Passed
Push — master ( 812b05...176334 )
by Konstantinos
02:19 queued 01:50
created

so_magic.data.built_in_commands   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A encode_nominal_subsets_command() 0 4 1
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