Unverified Commit 4eba1ce2 authored by Mufei Li's avatar Mufei Li Committed by GitHub
Browse files

[Chemistry] Hot fix (#953)

* Hot fix

* CI
parent 577cf2e6
...@@ -46,10 +46,12 @@ def one_hot_encoding(x, allowable_set, encode_unknown=False): ...@@ -46,10 +46,12 @@ def one_hot_encoding(x, allowable_set, encode_unknown=False):
The list is of length ``len(allowable_set)`` if ``encode_unknown=False`` The list is of length ``len(allowable_set)`` if ``encode_unknown=False``
and ``len(allowable_set) + 1`` otherwise. and ``len(allowable_set) + 1`` otherwise.
""" """
if encode_unknown: if encode_unknown and (allowable_set[-1] is not None):
allowable_set.append(None) allowable_set.append(None)
if x not in allowable_set:
x = None if encode_unknown and (x not in allowable_set):
x = None
return list(map(lambda s: x == s, allowable_set)) return list(map(lambda s: x == s, allowable_set))
################################################################# #################################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment