ERPP-RMTPP icon indicating copy to clipboard operation
ERPP-RMTPP copied to clipboard

Predicted Time calculation

Open SZH1230456 opened this issue 4 years ago • 8 comments

Hi, I am confused with the predicted time calculation in Equation (13) as follows: image I see it in the code, you just replace the predicted time with v^{t}.h_j, could you please illustrate it in detail?

SZH1230456 avatar Jul 09 '20 07:07 SZH1230456

The paper mentions that it uses certain "numerical integration techniques" to solve for 13. But, I could not find that in the official implementation (C++) at https://github.com/dunan/NeuralPointProcess.

@SZH1230456 Were you able to figure out something?

mohit2agrawal avatar Jul 19 '20 07:07 mohit2agrawal

def next_time(self,tj,hj):
    umax = self.umax #maximum time
    Deltat = umax/self.N
    dt = torch.linspace(0, umax, self.N+1)
    df = dt * self.fstart(dt, hj)
    #normalization factor
    integrand_ = ((df[1:] + df[:-1]) * 0.5) * Deltat
    integral_ = torch.sum(integrand_)
    return tj + integral_

This is the numerical method

Kaimaoge avatar Aug 01 '20 07:08 Kaimaoge

Thanks @Kaimaoge . I see that tf_rmtpp uses scipy.integrate.quad method.

mohit2agrawal avatar Aug 01 '20 07:08 mohit2agrawal

def next_time(self,tj,hj):
    umax = self.umax #maximum time
    Deltat = umax/self.N
    dt = torch.linspace(0, umax, self.N+1)
    df = dt * self.fstart(dt, hj)
    #normalization factor
    integrand_ = ((df[1:] + df[:-1]) * 0.5) * Deltat
    integral_ = torch.sum(integrand_)
    return tj + integral_

This is the numerical method

@Kaimaoge Hi, I‘m confused with the function of self.umax, self.N and self.fstart, could you please explain it?

liyuxisummer avatar Jan 19 '21 03:01 liyuxisummer

def next_time(self,tj,hj):
    umax = self.umax #maximum time
    Deltat = umax/self.N
    dt = torch.linspace(0, umax, self.N+1)
    df = dt * self.fstart(dt, hj)
    #normalization factor
    integrand_ = ((df[1:] + df[:-1]) * 0.5) * Deltat
    integral_ = torch.sum(integrand_)
    return tj + integral_

This is the numerical method

@Kaimaoge Hi, I‘m confused with the function of self.umax, self.N and self.fstart, could you please explain it?

umax is the upper limits of integration, N here is the number of units for calculating numerical integration, f_stat is the probability function.

Kaimaoge avatar Jan 19 '21 20:01 Kaimaoge

def next_time(self,tj,hj):
    umax = self.umax #maximum time
    Deltat = umax/self.N
    dt = torch.linspace(0, umax, self.N+1)
    df = dt * self.fstart(dt, hj)
    #normalization factor
    integrand_ = ((df[1:] + df[:-1]) * 0.5) * Deltat
    integral_ = torch.sum(integrand_)
    return tj + integral_

This is the numerical method

@Kaimaoge Hi, I‘m confused with the function of self.umax, self.N and self.fstart, could you please explain it?

umax is the upper limits of integration, N here is the number of units for calculating numerical integration, f_stat is the probability function.

@Kaimaoge Thanks, could you please share the code of fstart you used?

liyuxisummer avatar Jan 26 '21 07:01 liyuxisummer

Thanks @Kaimaoge . I see that tf_rmtpp uses scipy.integrate.quad method.

Always this method reports warning:

IntegrationWarning: The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. The error may be underestimated.

And the f_star always encounters exp() overflow. Also I am wondering the way they calculate the lambda: https://github.com/musically-ut/tf_rmtpp/blob/master/src/tf_rmtpp/rmtpp_core.py#L621 it is a little different from the paper

waystogetthere avatar Feb 02 '21 22:02 waystogetthere

def next_time(self,tj,hj):
    umax = self.umax #maximum time
    Deltat = umax/self.N
    dt = torch.linspace(0, umax, self.N+1)
    df = dt * self.fstart(dt, hj)
    #normalization factor
    integrand_ = ((df[1:] + df[:-1]) * 0.5) * Deltat
    integral_ = torch.sum(integrand_)
    return tj + integral_

This is the numerical method

@Kaimaoge Hi, I‘m confused with the function of self.umax, self.N and self.fstart, could you please explain it?

umax is the upper limits of integration, N here is the number of units for calculating numerical integration, f_stat is the probability function. hello, i use f_start to predict next time, but the rmse is too big, Have you ever tried this way?

zhzfight avatar Sep 05 '23 03:09 zhzfight