cerndb / dist-keras

Distributed Deep Learning, with a focus on distributed training, using Keras and Apache Spark.
http://joerihermans.com/work/distributed-keras/
GNU General Public License v3.0
624 stars 169 forks source link

Update transformers.py #39

Open raviolli opened 7 years ago

raviolli commented 7 years ago

Added support for 1D-List Features in OneHotEncodingTransformer

JoeriHermans commented 7 years ago

Hi,

Thanks for your contribution! Before merging, could you provide a usage example of this particular feature? Since it might impact performance to some extend.

Joeri

raviolli commented 6 years ago

UseCase:

#PERFORM ONE-HOT-ENCODING ON FEATURES
transformer = OneHotTransformer(output_dim=nb_classes, input_col="features", output_col="features_1hot")
dataset_ = transformer.transform(dataset)

Where "features" is an list (1D array) of features. It outputs a 2D np.array of OHE features.