a98578f25b2030dabac12c7bc71a3e30ed99fe1f,conceptnet5/vectors/propagate.py,,propagate,#Any#Any#Any#Any#Any#,118

Before Change


        // Then pick a neighbor for each, and use it to update the zero vector.
        adjacent_nonzeros = adjacency_matrix.dot(
            diags([nonzero_indices.astype(np.int8)], [0], format="csc"))
        neighbors = np.argmax(adjacent_nonzeros[fringe, :], axis=1)
        neighbors = neighbors.A[:, 0] // convert matrix to 1D ndarray
        vectors[fringe, :] = vectors[neighbors, :]

    n_old_plus_new_non_en = len(combined_index) - n_new_english

After Change


        // Update each as the average of its nonzero neighbors
        adjacent_nonzeros = adjacency_matrix[fringe, :].dot(
            diags([nonzero_indices.astype(np.int8)], [0], format="csc"))
        n_adjacent_nonzeros = adjacent_nonzeros.sum(axis=1).A[:, 0]
        weights = 1.0 / n_adjacent_nonzeros
        vectors[fringe, :] = adjacency_matrix[fringe, :].dot(vectors)
        vectors[fringe, :] = diags([weights], [0], format="csr").dot(
            vectors[fringe, :])

    n_old_plus_new_non_en = len(combined_index) - n_new_english
    result = pd.DataFrame(index=combined_index[0:n_old_plus_new_non_en],
                          data=vectors[0:n_old_plus_new_non_en, :])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: commonsense/conceptnet5
Commit Name: a98578f25b2030dabac12c7bc71a3e30ed99fe1f
Time: 2018-05-18
Author: rbeaudoin@luminoso.com
File Name: conceptnet5/vectors/propagate.py
Class Name:
Method Name: propagate


Project Name: explosion/thinc
Commit Name: 04046533b7a87572e730405bb1e11a076e7ed3d0
Time: 2017-02-21
Author: honnibal+gh@gmail.com
File Name: examples/text-pair/glove_mwe_multipool_predict.py
Class Name:
Method Name: main


Project Name: Pinafore/qb
Commit Name: 9d22742baeeb608bac5594c3ece96f62f0734dce
Time: 2017-05-13
Author: sjtufs@gmail.com
File Name: qanta/buzzer/trainer.py
Class Name: Trainer
Method Name: test