INNER CODE UNIT · Python
expand_matrix
AlexShakaev/backtesting_and_algotrading_options_with_Interactive_Brokers_API · utils/bocd.py:56
def expand_matrix(self):
L = self.R.shape[0]
self.R = np.pad(self.R, ((0,L),(0,L)))
self.length = self.R.shape[0]
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