32692a1ae53d7c5bf36564aeca1b572ddf40f9f0,arviz/stats/stats.py,,r2_score,#Any#Any#Any#,513

Before Change


        dimension = 1

    var_y_est = np.var(y_pred, axis=dimension)
    var_e = np.var(y_true - y_pred, axis=dimension)

    r_squared = var_y_est / (var_y_est + var_e)
    return pd.Series([np.median(r_squared), np.mean(r_squared), np.std(r_squared)],
                     index=["r2_median", "r2_mean", "r2_std"]).round(decimals=round_to)

After Change


    
    y_pred = np.atleast_2d(y_pred).mean(0)

    y_pred_ = []
    for _ in range(1000):
        idx = np.random.randint(0, len(y_true), size=len(y_true))
        y_pred_.append(_r_square(y_true, y_pred, idx))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: arviz-devs/arviz
Commit Name: 32692a1ae53d7c5bf36564aeca1b572ddf40f9f0
Time: 2018-06-29
Author: aloctavodia@gmail.com
File Name: arviz/stats/stats.py
Class Name:
Method Name: r2_score


Project Name: ixaxaar/pytorch-dnc
Commit Name: a6667bf98c59a7447a6bc55869459e83f5bdb603
Time: 2017-12-07
Author: root@ixaxaar.in
File Name: dnc/sparse_memory.py
Class Name: SparseMemory
Method Name: read_from_sparse_memory


Project Name: bulik/ldsc
Commit Name: 9a3a775a0139ad31a7fd313d46f09461100ce1d6
Time: 2015-04-18
Author: bbuliksullivan@gmail.com
File Name: ldscore/sumstats.py
Class Name:
Method Name: _check_variance


Project Name: apache/incubator-tvm
Commit Name: b121278a451243630fb67bf978079a8930de6558
Time: 2020-10-15
Author: mbrookhart@octoml.ai
File Name: tests/python/relay/test_op_level10.py
Class Name:
Method Name: verify_adaptive_pool