src/rime/models/hawkes.py
def _input_fn(hist_ts, test_start_time, horizon, training, training_eps, hetero):
    """ format to data and ctrl channels relative to the first observation """
    if len(hist_ts):
        data = (np.array(hist_ts[1:]) - hist_ts[0]) / horizon
        end_time = (test_start_time - hist_ts[0]) / horizon
    else:  # users without histories will receive baseline intensity predictions
        data = np.array([], dtype=np.asarray(test_start_time).dtype)
        end_time = float('inf')

    ctrl = np.array([0.0, end_time]) if hetero else np.array([end_time])

    if training:
        if training_eps > 0:
            data = np.sort(data + np.random.rand(len(data)) * training_eps)
            end_time = end_time + training_eps
        return [data, ctrl]
    else:
        return [data, ctrl[:-1]], end_time
 format to data and ctrl channels relative to the first observation 
format to data and ctrl channels relative to the first observation
format to data and ctrl channels relative to the first observation
def _input_fn(hist_ts, test_start_time, horizon, training, training_eps, hetero):
    if len(hist_ts):
        data = (np.array(hist_ts[1:]) - hist_ts[0]) / horizon
        end_time = (test_start_time - hist_ts[0]) / horizon
    else:  
        data = np.array([], dtype=np.asarray(test_start_time).dtype)
        end_time = float('inf')
    ctrl = np.array([0.0, end_time]) if hetero else np.array([end_time])
    if training:
        if training_eps > 0:
            data = np.sort(data + np.random.rand(len(data)) * training_eps)
            end_time = end_time + training_eps
        return [data, ctrl]
    else:
        return [data, ctrl[:-1]], end_time
def _input_fn ( hist_ts , test_start_time , horizon , training , training_eps , hetero ) : if len ( hist_ts ) : data = ( np . array ( hist_ts [ 1 : ] ) - hist_ts [ 0 ] ) / horizon end_time = ( test_start_time - hist_ts [ 0 ] ) / horizon else : data = np . array ( [ ] , dtype = np . asarray ( test_start_time ) . dtype ) end_time = float ( 'inf' ) ctrl = np . array ( [ 0.0 , end_time ] ) if hetero else np . array ( [ end_time ] ) if training : if training_eps > 0 : data = np . sort ( data + np . random . rand ( len ( data ) ) * training_eps ) end_time = end_time + training_eps return [ data , ctrl ] else : return [ data , ctrl [ : - 1 ] ] , end_time
format to data and ctrl channels relative to the first observation
format to data and ctrl channels relative to the first observation
""" format to data and ctrl channels relative to the first observation """ # users without histories will receive baseline intensity predictions
hist_ts
test_start_time
horizon
training
training_eps
hetero