Skip to content

Only labeler.get_keys() is sorted in the same order as L_train #79

@HiromuHota

Description

@HiromuHota

Describe the bug

In the hardware tutorial, a sorted list of LFs is fed into LFAnalytics like below:

from snorkel.labeling import LFAnalysis

# Sort LFs for LFAnalysis because LFAnalysis does not sort LFs,
# while columns of L_train are sorted alphabetically already.
sorted_lfs = sorted(stg_temp_lfs, key=lambda lf: lf.name)

LFAnalysis(L=L_train[0], lfs=sorted_lfs).lf_summary(Y=L_gold_train[0].reshape(-1))

While sorted_lfs is sorted alphabetically case-sensitive, the columns of L_train is sorted alphabetically case-insensitive (subject to the postgres config (https://dba.stackexchange.com/a/131471)).

To Reproduce

N/A.

Expected behavior

LFAnalysis should be fed LFs that is sorted in the same order as L_train, and only labeler.get_keys() is sorted in the same way no matter how Postgres is configured.

Error Logs/Screenshots

N/A.

Environment (please complete the following information):

N/A.

Additional context

This was introduced by #68.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions