HazyResearch / flyingsquid

More interactive weak supervision with FlyingSquid
Apache License 2.0
313 stars 21 forks source link

Some small fixs #5

Closed Alice86 closed 4 years ago

Alice86 commented 4 years ago

Hello!

It is a fascinating work and thank you for sharing the code. I have been playing with the code for a week, and feel like to brought to your attention some small bugs.

  1. When in a maximal clique there are all observed lambdas and no latent variable y, three typos on line 688, line 814 and line 984.

    # line 688
           easy_marginals[marginal] = JointProbabilityDistribution(
    # line 814
                lf_vecs = lambda_marginal_vecs[marginal]
    # line 984
                if indices not in lambda_marginals:
  2. After line 309, miss a condition to break from a for-loop when a triplet is found (produce triplets of two).

    # starting line 307 --
                        triplet = [expectation, first_node, second_node]
                        found = True
                        break
    
                    # add these two lines
                    if found:
                        break
    
                if not found:
  3. In the tutorials, the accuracy computed for Majority Voting is incorrect, as the prediction are not converted to {+1, -1} to match the ground truth but instead {True, False}:

    # In [9]
    majority_vote_accuracy = np.sum(majority_vote_preds*2-1 == Y_dev) / Y_dev.shape[0]

Hope it helps and thanks again!

DanFu09 commented 4 years ago

Thanks for your comments!

For 1, I'm not sure I understand what you mean exactly - each of those is a special case for dealing with marginals that have no Y's in them (these marginals are observable, so we just need to write down how often the lambda votes co-occur).

Thanks for pointing out 2 and 3, added in the fixes!

Alice86 commented 4 years ago

Thanks for your comments!

For 1, I'm not sure I understand what you mean exactly - each of those is a special case for dealing with marginals that have no Y's in them (these marginals are observable, so we just need to write down how often the lambda votes co-occur).

Thanks for pointing out 2 and 3, added in the fixes!

Missing 's' in 'easy_marginals' and 'lf_vecs', variable 'lambda_moment_vals' should be 'lambda_marginals' in the original code.