Skip to content

Commit f7fbf4d

Browse files
Refactor _set_to_multihot (#670)
* fix : update _set_to_multihot function * doc : update CHANGELOG.md
1 parent b7a480c commit f7fbf4d

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
- `pycmError` class
1010
### Changed
1111
- `__trapezoidal_numeric_integral__` function updated
12+
- `_set_to_multihot` function updated
1213
- Curve validation modified
1314
- Internal functions renamed
1415
- `README.md` modified

pycm/multilabel_cm.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,4 @@ def _set_to_multihot(input_set: Set[Any], classes: List[Any]) -> List[int]:
174174
:param input_set: input set
175175
:param classes: ordered labels of classes
176176
"""
177-
result = [0] * len(classes)
178-
for i, x in enumerate(classes):
179-
if x in input_set:
180-
result[i] = 1
181-
return result
177+
return [int(x in input_set) for x in classes]

0 commit comments

Comments
 (0)