Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Commit

Permalink
Update transformers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
raviolli authored Oct 17, 2017
1 parent 587be91 commit b0b156e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions distkeras/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,15 @@ def _transform(self, row):
Only for internal use.
"""
label = row[self.input_column]
vector = to_one_hot_encoded_dense(label, self.output_dimensionality)
new_row = new_dataframe_row(row, self.output_column, vector.tolist())

if(isinstance(label, types.ListType)):
vector = np.zeros((len(label), self.output_dimensionality))
for i in range(len(label)):
vector[i] = to_one_hot_encoded_dense(label[i], self.output_dimensionality)
else:
vector = to_one_hot_encoded_dense(label, self.output_dimensionality)

new_row = new_dataframe_row(row, self.output_column, vector.tolist())
return new_row

def transform(self, dataframe):
Expand Down

1 comment on commit b0b156e

@raviolli
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support for 1D-List Features in OneHotEncodingTransformer

Please sign in to comment.