eb8c188803d258dbcae61764ffe8085db627424b,elfi/examples/daycare.py,,ss_shannon,#Any#,195

Before Change


    np.array of shape (batch_size, n_dcc)

    
    proportions = np.sum(data, axis=2) / data.shape[2]
    shannon = -np.sum(proportions * np.log(proportions + 1e-9), axis=2)  // axis 3 is now 2

    return shannon

After Change



    
    total_obs = np.sum(data, axis=2, keepdims=True)
    with np.errstate(divide="ignore", invalid="ignore"):
        proportions = np.nan_to_num(total_obs / np.sum(total_obs, axis=3, keepdims=True))
    proportions[proportions == 0] = 1
    shannon = (-np.sum(proportions * np.log(proportions), axis=3))[:, :, 0]

    return shannon
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: elfi-dev/elfi
Commit Name: eb8c188803d258dbcae61764ffe8085db627424b
Time: 2019-11-25
Author: 33959025+hpesonen@users.noreply.github.com
File Name: elfi/examples/daycare.py
Class Name:
Method Name: ss_shannon


Project Name: snorkel-team/snorkel
Commit Name: 98e6a637cf96d77e9e309c1049f52387f11e8ed7
Time: 2017-09-25
Author: rogergoldman@gmail.com
File Name: snorkel/utils.py
Class Name:
Method Name: matrix_conflicts


Project Name: scipy/scipy
Commit Name: f1ce87f99e143246d55b9f45b704563f5f5ac2a7
Time: 2016-02-09
Author: perimosocordiae@gmail.com
File Name: scipy/sparse/dok.py
Class Name: dok_matrix
Method Name: __add__


Project Name: hmmlearn/hmmlearn
Commit Name: 845c288415ad7a9ef12d02f6fe3746107c054b37
Time: 2019-11-29
Author: anntzer.lee@gmail.com
File Name: lib/hmmlearn/hmm.py
Class Name: GMMHMM
Method Name: _accumulate_sufficient_statistics