19fbae4ea6092bfc69e4f828febbd15f72365311,cesium/features/cadence_features.py,,delta_t_hist,#,22

Before Change


    Build histogram of all possible delta_t"s without storing every value
    hist = np.zeros(nbins, dtype="int")
    bins = np.linspace(0, max(t) - min(t), nbins + 1)
    for i in range(len(t)):
        hist += np.histogram(t[i] - t[:i], bins=bins)[0]
        hist += np.histogram(t[i + 1:] - t[i], bins=bins)[0]
    return hist / 2  // Double-counts since we loop over every pair twice


def normalize_hist(hist, total_time):

After Change


    and then aggregate the result to have `nbins` total values.
    
    f, x = np.histogram(t, bins=conv_oversample * nbins)
    g = np.convolve(f, f[::-1])[len(f) - 1:]  // Discard negative domain
    g[0] -= len(t)  // First bin is double-counted because of i=j terms
    hist = g.reshape((-1, conv_oversample)).sum(axis=1)  // Combine bins
    return hist


def normalize_hist(hist, total_time):
    Normalize histogram such that integral from t_min to t_max equals 1.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: cesium-ml/cesium
Commit Name: 19fbae4ea6092bfc69e4f828febbd15f72365311
Time: 2016-11-10
Author: brettnaul@gmail.com
File Name: cesium/features/cadence_features.py
Class Name:
Method Name: delta_t_hist


Project Name: mariogeiger/se3cnn
Commit Name: aa0eb70303fbf5f844a9767949656c29dbac0f11
Time: 2019-07-09
Author: geiger.mario@gmail.com
File Name: se3cnn/convolution.py
Class Name: SE3PointConvolution
Method Name: forward


Project Name: librosa/librosa
Commit Name: d2bf859306e7c108cfcdb79e4d7af8845866493a
Time: 2018-02-08
Author: brian.mcfee@nyu.edu
File Name: librosa/feature/utils.py
Class Name:
Method Name: delta