snorkel-team / snorkel

A system for quickly generating training data with weak supervision
https://snorkel.org
Apache License 2.0
5.81k stars 857 forks source link

Accept prec_init as array or list #1616

Closed antonis19 closed 3 years ago

antonis19 commented 4 years ago

Description of proposed changes

Currently, LabelModel only accepts a float or an int for prec_init. These get converted into a 1D tensor of the same value. In this pull request, prec_init can be passed as np.ndarray or as a Python list also. This way different labeling functions can get assigned different priors.

Related issue(s)

Fixes #1484

Test plan

Checklist

Need help on these? Just ask!

codecov[bot] commented 4 years ago

Codecov Report

Merging #1616 (9c5f4bf) into master (ed77718) will increase coverage by 0.10%. The diff coverage is 85.71%.

@@            Coverage Diff             @@
##           master    #1616      +/-   ##
==========================================
+ Coverage   97.21%   97.31%   +0.10%     
==========================================
  Files          68       68              
  Lines        2151     2157       +6     
  Branches      345      348       +3     
==========================================
+ Hits         2091     2099       +8     
+ Misses         31       30       -1     
+ Partials       29       28       -1     
Impacted Files Coverage Δ
snorkel/labeling/model/label_model.py 96.30% <85.71%> (+0.76%) :arrow_up:
antonis19 commented 3 years ago

@henryre I took care of the comments you made. Now there seems to be a build error even though all the tests pass. It seems to me that these are errors related to the build configuration, or am I wrong?

henryre commented 3 years ago

The build issues should be resolved on trunk. Re-running for this PR: https://github.com/snorkel-team/snorkel/pull/1616/checks?check_run_id=1764471482

antonis19 commented 3 years ago

@henryre seems that all the tests are passing except for codecov/patch. What would we need to do to fix this?