INNER CODE UNIT · Python

update

AlexShakaev/backtesting_and_algotrading_options_with_Interactive_Brokers_API · utils/bocd.py:61

    def update(self, x):   
        self.cp_detected = False
        
        if self.t == self.length - 1:
            self.expand_matrix()
                      
        t  = self.t
        
        predprobs = np.round(self.observation_likelihood.pdf(x), 16)
        # Evaluate the hazard function for this interval
        H = self.H(np.array(range(t + 1)))

        # Evaluate the growth probabilities - shift the probabilities down and to
        # the right, scaled by the hazard function and the predictive
        # probabilities.
        self.R[1 : t + 2, t + 1] = self.R[0 : t + 1, t] * predprobs * (1 - H)

        # Evaluate the probability that there *was* a changepoint and we're

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…