lore_sa.encoder_decoder.OneHotEnc

class lore_sa.encoder_decoder.OneHotEnc(descriptor: dict)[source]

It provides an interface to access One Hot enconding (https://en.wikipedia.org/wiki/One-hot) functions. It relies on OneHotEncoder class from sklearn

__init__(descriptor: dict)[source]

Methods

__init__(descriptor)

add_encoded_features(encoded_features)

clean_encoded_descriptor_by_old(old_field)

decode(x)

Decode the array staring from the original descriptor

decode_target_class(x)

encode(x)

It applies the encoder to the input features

get_encoded_features()

Provides a dictionary with the new encoded features name and the new index :return:

update_encoded_index(current_field, size)

decode(x: array)[source]

Decode the array staring from the original descriptor

Parameters

x ([Numpy array]) – Array to decode

Return [Numpy array]

Decoded array

encode(x: array)[source]

It applies the encoder to the input features

Parameters

x ([Numpy array]) – Array to encode

Return [Numpy array]

Encoded array

get_encoded_features()[source]

Provides a dictionary with the new encoded features name and the new index :return: