-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bug in recreating featurizers (#26)
- Loading branch information
1 parent
367cd6c
commit fa455e8
Showing
2 changed files
with
10 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import numpy as np | ||
|
||
def recreate_featurizer(featurizer_name, featurizer_config): | ||
featurizer_class = getattr(__import__( | ||
'jaqpotpy.descriptors.molecular', | ||
fromlist=[featurizer_name]), featurizer_name) | ||
|
||
def recreate_featurizer(featurizer_name, featurizer_config): | ||
featurizer_class = getattr( | ||
__import__("jaqpotpy.descriptors.molecular", fromlist=[featurizer_name]), | ||
featurizer_name, | ||
) | ||
featurizer = featurizer_class() | ||
for attr, value in featurizer_config.items(): | ||
if attr !='class': # skip the class attribute | ||
if attr != "class": # skip the class attribute | ||
if isinstance(value, list): | ||
value = np.array(value['value']) | ||
setattr(featurizer, attr, value['value']) | ||
return featurizer | ||
value = np.array(value["value"]) | ||
setattr(featurizer, attr, value) | ||
return featurizer |