Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tqdm>=4.33.0,<5.0.0
# Internal models
scikit-learn>=0.20.2,<0.22.0
torch>=1.1.0,<1.2.0
munkres==1.1.2
munkres>=1.0.6

# LF dependency learning
networkx>=2.2,<2.4
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
packages=find_packages(),
include_package_data=True,
install_requires=[
"munkres==1.1.2",
"munkres>=1.0.6",
Copy link
Member

Choose a reason for hiding this comment

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

are these version commits related to this patch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They're not, but tox -e check was failing without it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll try reverting it and see if travis ci passes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CI fails if I revert.

"numpy>=1.16.0,<2.0.0",
"scipy>=1.2.0,<2.0.0",
"pandas>=0.25.0,<0.26.0",
Expand Down
2 changes: 2 additions & 0 deletions snorkel/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def to_int_label_array(X: np.ndarray, flatten_vector: bool = True) -> np.ndarray
# Correct shape
if flatten_vector:
X = X.squeeze()
if X.ndim == 0:
X = np.expand_dims(X, 0)
if X.ndim != 1:
raise ValueError("Input could not be converted to 1d np.array")
return X
Expand Down
4 changes: 4 additions & 0 deletions test/utils/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def test_to_int_label_array(self):
Y = to_int_label_array(X, flatten_vector=True)
np.testing.assert_array_equal(Y, Y_expected)

Y = to_int_label_array(np.array([[1]]), flatten_vector=True)
Y_expected = np.array([1])
np.testing.assert_array_equal(Y, Y_expected)

Comment on lines +24 to +27
Copy link
Member

Choose a reason for hiding this comment

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

nice!

Y = to_int_label_array(X, flatten_vector=False)
Y_expected = np.array([[1], [0], [2]])
np.testing.assert_array_equal(Y, Y_expected)
Expand Down