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

Before Change


    if y_true.ndim > 1:
        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_ = []
    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))

    idx = range(len(y_true))
    r_squared = _r_square(y_true, y_pred, idx)
    return pd.Series([r_squared, np.std(y_pred_)],
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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: 049c293a83ba05d11956568a5c1835757a09e4ef
Time: 2017-11-30
Author: root@ixaxaar.in
File Name: dnc/sparse_memory.py
Class Name: SparseMemory
Method Name: read_from_sparse_memory


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: e70bdb2d089ae283781c45b8d97963823a984baa
Time: 2017-12-15
Author: max.lapan@gmail.com
File Name: ch10/00_pong_pg.py
Class Name:
Method Name: