6367318f455aa8c27b6341c9b98794351dfd168e,examples/pytorch/pinsage/data_utils.py,,train_test_split_by_time,#Any#Any#Any#,9

Before Change


    df["test_mask"] = np.zeros((len(df),), dtype=np.bool)
    df = df.sort_values([item, timestamp])
    for track_id in df[item].unique():
        idx = (df[item] == track_id).to_numpy().nonzero()[0]
        idx = df.index[idx]
        if len(idx) > 1:
            df.loc[idx[-1], "train_mask"] = False
            df.loc[idx[-1], "test_mask"] = True
        if len(idx) > 2:

After Change


            df.iloc[-2, -3] = False
            df.iloc[-2, -2] = True
        return df
    df = df.groupby(item).apply(train_test_split).compute(scheduler="processes").sort_index()
    print(df[df[item] == df[item].unique()[0]].sort_values(timestamp))
    return df["train_mask"].to_numpy().nonzero()[0], \
           df["val_mask"].to_numpy().nonzero()[0], \
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: dmlc/dgl
Commit Name: 6367318f455aa8c27b6341c9b98794351dfd168e
Time: 2020-08-17
Author: coin2028@hotmail.com
File Name: examples/pytorch/pinsage/data_utils.py
Class Name:
Method Name: train_test_split_by_time


Project Name: neurosynth/neurosynth
Commit Name: 73675264dd48387319f62780b52d81389016cc1f
Time: 2014-03-24
Author: tyarkoni@gmail.com
File Name: neurosynth/base/dataset.py
Class Name: FeatureTable
Method Name: get_features_by_ids


Project Name: daavoo/pyntcloud
Commit Name: 1b5d8f9cd1e7be8f23209fd252ab04eafb7b5b0c
Time: 2016-11-23
Author: daviddelaiglesiacastro@gmail.com
File Name: pyntcloud/structures/octree.py
Class Name: OcTree
Method Name: query


Project Name: AlexsLemonade/refinebio
Commit Name: 12b19fcbf91e9d02bd8b2a67ce96e2d00d1d5ed7
Time: 2019-10-01
Author: arielsvn@gmail.com
File Name: foreman/data_refinery_foreman/foreman/management/commands/check_computed_files.py
Class Name: Command
Method Name: handle