53a93d8af5d041f6c5dfdef2fb763f8419e3023d,matchzoo/datasets/snli/load_data.py,,load_data,#Any#Any#Any#,14

Before Change


        raise ValueError(f"{stage} is not a valid stage."
                         f"Must be one of `train`, `dev`, and `test`.")

    data_root = _download_data()
    file_path = data_root.joinpath(f"snli_1.0_{stage}.txt")
    data_pack = _read_data(file_path)

    if task == "ranking":
        task = matchzoo.tasks.Ranking()
    if task == "classification":
        task = matchzoo.tasks.Classification()

    if isinstance(task, matchzoo.tasks.Ranking):
        if target_label not in ["entailment", "contradiction", "neutral", "-"]:
            raise ValueError
        binary = (data_pack.relation["label"] == target_label).astype(float)
        data_pack.relation["label"] = binary
        return data_pack
    elif isinstance(task, matchzoo.tasks.Classification):
        classes = ["entailment", "contradiction", "neutral", "-"]
        label = data_pack.relation["label"].apply(classes.index)
        data_pack.relation["label"] = label
        data_pack.one_hot_encode_label(num_classes=4, inplace=True)
        return data_pack, classes
    else:
        raise ValueError(f"{task} is not a valid task.")

After Change



    data_root = _download_data()
    file_path = data_root.joinpath(f"snli_1.0_{stage}.txt")
    data_pack = _read_data(file_path)

    if task == "ranking":
        task = matchzoo.tasks.Ranking()
    if task == "classification":
        task = matchzoo.tasks.Classification()

    if isinstance(task, matchzoo.tasks.Ranking):
        if target_label not in ["entailment", "contradiction", "neutral", "-"]:
            raise ValueError
        binary = (data_pack.relation["label"] == target_label).astype(float)
        data_pack.relation["label"] = binary
        return data_pack
    elif isinstance(task, matchzoo.tasks.Classification):
        classes = ["entailment", "contradiction", "neutral", "-"]
        label = data_pack.relation["label"].apply(classes.index)
        data_pack.relation["label"] = label
        data_pack.one_hot_encode_label(num_classes=4, inplace=True)
        if return_classes:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: NTMC-Community/MatchZoo
Commit Name: 53a93d8af5d041f6c5dfdef2fb763f8419e3023d
Time: 2019-01-19
Author: i@uduse.com
File Name: matchzoo/datasets/snli/load_data.py
Class Name:
Method Name: load_data


Project Name: matplotlib/matplotlib
Commit Name: 66348a9259bc034d0f6b21cfb554f8b2f0af94b0
Time: 2018-03-23
Author: anntzer.lee@gmail.com
File Name: tools/triage_tests.py
Class Name:
Method Name: find_failing_tests


Project Name: hyperspy/hyperspy
Commit Name: 629167ee324a0b955ef46cd5a0cd7bb504ef8c44
Time: 2020-09-09
Author: tjof2@cam.ac.uk
File Name: hyperspy/misc/io/tools.py
Class Name:
Method Name: append2pathname