Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in tutorial #1106

Closed
siddu9501 opened this issue May 21, 2019 · 6 comments
Closed

Error in tutorial #1106

siddu9501 opened this issue May 21, 2019 · 6 comments

Comments

@siddu9501
Copy link

siddu9501 commented May 21, 2019

Used the Conda Env to create the env and install snorkel.
Throws this error in intro_tutorial_2:

from snorkel.lf_helpers import test_LF tp, fp, tn, fn = test_LF(session, LF_wife_in_sentence, split=1, annotator_name='gold')
Output:


AttributeError Traceback (most recent call last)
~/anaconda3/envs/snorkel/lib/python3.6/site-packages/snorkel/learning/utils.py in _score_binary(self, test_marginals, b, set_unlabeled_as_neg, set_at_thresh_as_neg, display, **kwargs)
178 test_label_index = self.test_labels.get_row_index(candidate)
--> 179 test_label = self.test_labels[test_label_index, 0]
180 except AttributeError:

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/snorkel/annotations.py in getitem(self, key)
102 X.annotation_key_cls = self.annotation_key_cls
--> 103 row_slice, col_slice = self._unpack_index(key)
104 X.row_index, X.candidate_index = self._get_sliced_indexes(

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/scipy/sparse/base.py in getattr(self, attr)
687 else:
--> 688 raise AttributeError(attr + " not found")
689

AttributeError: _unpack_index not found

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
in
1 from snorkel.lf_helpers import test_LF
----> 2 tp, fp, tn, fn = test_LF(session, LF_wife_in_sentence, split=1, annotator_name='gold')

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/snorkel/lf_helpers.py in test_LF(session, lf, split, annotator_name)
214 scorer = MentionScorer(test_candidates, test_labels)
215 test_marginals = np.array([0.5 * (lf(c) + 1) for c in test_candidates])
--> 216 return scorer.score(test_marginals, set_unlabeled_as_neg=False, set_at_thresh_as_neg=False)

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/snorkel/learning/utils.py in score(self, test_marginals, **kwargs)
130 cardinality = self._get_cardinality(test_marginals)
131 if cardinality == 2:
--> 132 return self._score_binary(test_marginals, **kwargs)
133 else:
134 return self._score_categorical(test_marginals, **kwargs)

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/snorkel/learning/utils.py in _score_binary(self, test_marginals, b, set_unlabeled_as_neg, set_at_thresh_as_neg, display, **kwargs)
179 test_label = self.test_labels[test_label_index, 0]
180 except AttributeError:
--> 181 test_label = self.test_labels[i]
182
183 # Set unlabeled examples to -1 by default

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/snorkel/annotations.py in getitem(self, key)
101 # X must be a matrix, so update appropriate csr_AnnotationMatrix fields
102 X.annotation_key_cls = self.annotation_key_cls
--> 103 row_slice, col_slice = self._unpack_index(key)
104 X.row_index, X.candidate_index = self._get_sliced_indexes(
105 row_slice, 0, self.row_index, self.candidate_index)

~/anaconda3/envs/snorkel/lib/python3.6/site-packages/scipy/sparse/base.py in getattr(self, attr)
686 return self.getnnz()
687 else:
--> 688 raise AttributeError(attr + " not found")
689
690 def transpose(self, axes=None, copy=False):

AttributeError: _unpack_index not found

@mike-oakley
Copy link

I also encountered this error. It appears the latest release of Scipy (1.3.0) breaks the csr_AnnotationMatrix class (which inherits from scipy.sparse.csr_matrix). Installing the previous latest release (1.2.1) resolves this for me.

lapolonio added a commit to lapolonio/snorkel that referenced this issue May 23, 2019
@bhancock8
Copy link
Member

Fixed in #1111.

@cristianmtr
Copy link

Has this fix been released yet? I am getting this exact issue

@WithIbadKhan
Copy link

when i run Gradesearchcv ()

AttributeError: split not found
this error i face please help me any one.

@bhancock8
Copy link
Member

when i run Gradesearchcv ()

AttributeError: split not found this error i face please help me any one.

@WithIbadKhan given it's been a couple years since this issue was closed, would you mind opening a new issue, following the template so we have more information on what version of the library you're running, what the state of your environment is when you see the error, etc?

@bhancock8
Copy link
Member

Looks like you're already on top of it with #1712. Perfect! We can take the conversation there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants