Skip to content

Commit

Permalink
Update features.py
Browse files Browse the repository at this point in the history
Fixed:
ValueError: Samples can not be a single string. The input must be an iterable over iterables of strings.

By:
entry_name_hashed = FeatureHasher(50, input_type="string").transform([raw_obj['entry']]).toarray()[0] 
with:
entry_name_hashed = FeatureHasher(50, input_type="string").transform([ [raw_obj['entry']] ]).toarray()[0] 

at line 192.

In this way an iterable over iterable over raw features is obtained, as transform() method require.
  • Loading branch information
pturnah authored Apr 6, 2024
1 parent d97a0b5 commit 9fcf8fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ember/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def process_raw_features(self, raw_obj):
section_entropy_hashed = FeatureHasher(50, input_type="pair").transform([section_entropy]).toarray()[0]
section_vsize = [(s['name'], s['vsize']) for s in sections]
section_vsize_hashed = FeatureHasher(50, input_type="pair").transform([section_vsize]).toarray()[0]
entry_name_hashed = FeatureHasher(50, input_type="string").transform([raw_obj['entry']]).toarray()[0]
entry_name_hashed = FeatureHasher(50, input_type="string").transform([ [raw_obj['entry']] ]).toarray()[0]
characteristics = [p for s in sections for p in s['props'] if s['name'] == raw_obj['entry']]
characteristics_hashed = FeatureHasher(50, input_type="string").transform([characteristics]).toarray()[0]

Expand Down

1 comment on commit 9fcf8fc

@pturnah
Copy link
Author

@pturnah pturnah commented on 9fcf8fc Apr 7, 2024

Choose a reason for hiding this comment

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

link to fix #103

Please sign in to comment.