0d768b06d5aea91bd6f8755e605f2c706a9373f8,conceptnet5/vectors/transforms.py,,standardize_row_labels,#,6

Before Change


    standardized URI get combined, with earlier rows given more weight.
    
    // Re-label the DataFrame with standardized, non-unique row labels
    frame.index = pd.Series(
        [standardized_uri(language, label) for label in frame.index],
        name="term"
    )

    // Assign row n a weight of 1/(n+1) for weighted averaging
    nrows = frame.shape[0]
    weights = 1.0 / np.arange(1, nrows + 1)
    label_weights = pd.Series(weights, index=frame.index)

    // groupby(level=0).sum() means to add rows that have the same label
    relabeled = frame.mul(weights, axis="rows").sort_index().groupby(level=0).sum()
    combined_weights = label_weights.sort_index().groupby(level=0).sum()
    return relabeled.div(combined_weights, axis="rows")


def l1_normalize_columns(frame):
    

After Change


    // groupby(level=0).sum() means to add rows that have the same label
    relabeled = frame.mul(weights, axis="rows").sort_index().groupby(level=0).sum()
    combined_weights = label_weights.sort_index().groupby(level=0).sum()
    scaled = relabeled.div(combined_weights, axis="rows")

    // Rearrange the items in descending order of weight, similar to the order
    // we get them in from word2vec and GloVe
    combined_weights.sort(ascending=False)
    result = scaled.loc[combined_weights.index.drop_duplicates()]
    assert not result.index.has_duplicates
    return result


def l1_normalize_columns(frame):
    
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: commonsense/conceptnet5
Commit Name: 0d768b06d5aea91bd6f8755e605f2c706a9373f8
Time: 2016-02-24
Author: rob@luminoso.com
File Name: conceptnet5/vectors/transforms.py
Class Name:
Method Name: standardize_row_labels


Project Name: commonsense/conceptnet5
Commit Name: e33d1ba9150a3084947ae000f12a9b6f2f644648
Time: 2017-02-23
Author: joanna.teresa.duda@gmail.com
File Name: conceptnet5/vectors/evaluation/wordsim.py
Class Name:
Method Name: evaluate_semeval_monolingual


Project Name: cesium-ml/cesium
Commit Name: 09bfc1b3ef8494cf17a192bbe83df576ccdac86f
Time: 2016-06-29
Author: brettnaul@gmail.com
File Name: cesium/predict.py
Class Name:
Method Name: model_predictions